Commit graph

11 commits

Author SHA1 Message Date
Joey Orlando
b26706e7e4
configure yamllint pre-commit step (#2728)
# What this PR does

Add [`yamllint`](https://github.com/adrienverge/yamllint) to
`pre-commit` configuration + fix pre-existing errors

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-08-03 02:35:08 -04:00
Vadim Stepanov
f977f9faee
Minor formatting changes (#2641)
# What this PR does

- Updates `black` and `flake8` to latest
- Removes `F541` from flake8 ignore (`F541 f-string is missing
placeholders`)
- Enables ["float to top"
option](https://pycqa.github.io/isort/docs/configuration/options.html#float-to-top)
for `isort`
2023-07-26 14:45:44 +01:00
Jack Baldry
1735db4c3b
Update all links to use docs/reference style (#2456)
# What this PR does

The `docs/reference` shortcode supports contextual destinations and
version inference.

`<ONCALL VERSION>` is inferred to match the version of the documentation
set. For example, the inferred version for the page
/docs/grafana/oncall/latest/get-started/ is "latest". It can also be
overriden using front matter.
Given the same page, but with the additional front matter
`oncall_version: next`, the variable is substituted with "next" rather
than "latest".

Contextual destinations are achieved using repeated labels in the
shortcode inner text. The format is [<LABEL>]: "<PAGE PATH PREFIX> ->
<HUGO REFERENCE>".

- _`<LABEL>`_ matches the reference style link label used in the rest of
the text.
- _`<PAGE PATH PREFIX>`_ is matched against the page during the
production build. If the match is successful, the destination that is
used is _`<HUGO REFERENCE>`_. The first matching prefix is used, not the
longest matching prefix.

## Which issue(s) this PR fixes

- Broken links due to ambiguous relref resolution. Any relref parameter
that does not start with either `/`, `./`, or `../` can resolve
ambiguously and is resulting in broken link behavior on the current
site.
- Broken links in Grafana Cloud. We mount OnCall documentation in
Grafana Cloud. In https://github.com/grafana/website/pull/13872 the
location will become /docs/grafana-cloud/alerting-and-irm/oncall. This
PR is intended to be merged alongside that PR.

---------

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
2023-07-13 14:38:35 +00:00
Joey Orlando
1eb9658541
fix failing lint github actions job due to issue w/ isort version (#1249)
# What this PR does

## Which issue(s) this PR fixes

`lint` github action jobs on all builds are failing right now
([example](https://github.com/grafana/oncall/actions/runs/4042567074/jobs/6950923821#step:6:16))
because of [this issue](https://github.com/PyCQA/isort/issues/2077) with
`isort`

## Checklist

- [ ] Tests updated
- [ ] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-30 11:43:15 +01:00
Ildar Iskhakov
615a2e8333
Fix markdown formatting in docs (#1202)
# What this PR does

This PR adds `--fix` flag to `markdownlint` pre-commit command and fixes
existing formatting to comply with markdown formatting rules.

## Which issue(s) this PR fixes

## Checklist

- [ ] Tests updated
- [x] Documentation added
- [ ] `CHANGELOG.md` updated
2023-01-24 10:58:38 +01:00
Joey Orlando
98241b9a10
fake-data generation script + fixes for django-silk and django-debug-toolbar (#1128)
# What this PR does

## Main stuff

- add Python script to populate local Grafana/OnCall setup w/ large
amounts of fake data. Right now the data types that can be generated
are:
- teams and Admin users via the Grafana API (must be synced manually by
going into the UI before going onto the next step)
- Calendar Schedules which have three 8h oncall-shifts, via the OnCall
public API
- fixes `django-debug-toolbar` when being run in `docker-compose`
locally

## Other stuff
- documents how to easily modify the Grafana `docker-compose` container
provisioning configuration
- document solutions for two backend setup related issues encountered
when running the engine/celery workers locally, outside of
`docker-compose`, on an Apple silicon Mac
- fixes small bug in `grafana_plugin.helpers.client.APIClient.call_api`
where it would call `response.json()` for all requests, regardless of
whether or not the response actually contained data or not
- in `engine/settings/dev.py`, properly setup `django-silk` and document
the steps to use it locally
- make it possible to log out debug SQL queries by specifying
`DEV_DEBUG_VIEW_SQL_QUERIES` env var, rather than having to uncomment
out a section of `settings/dev.py`

## Which issue(s) this PR fixes

- Some local setup issues when trying to use `django-silk` and
`django-debug-toolbar`
- Makes it much easier to populate your local setup with a lot of fake
data
- Makes it possible to easily modify your local grafana's provisioning
configuration

## Checklist

- [ ] Tests updated (N/A)
- [ ] Documentation added (N/A)
- [ ] `CHANGELOG.md` updated (N/A)
2023-01-20 09:19:41 +01:00
Rares Mardare
db2e4f4018
Update prettier@2.8.2 (#1112)
# What this PR does

Updated prettier to `2.8.2` to fix linter issue on CI
2023-01-09 17:50:55 +02:00
Vadim Stepanov
1b67a8ec68
Add PD migrator lint & test steps to CI (#1053)
# What this PR does

- Add PD migrator related hooks to `.pre-commit-config.yaml`
- Add Github Actions step for running PD migrator tests
2022-12-30 16:03:39 +00:00
Joey Orlando
c08eeb72a3
add precommit rules for markdown/json files (#915)
* add markdownlint precommit steps + fix existing errors

* prettier json linting
2022-12-01 14:26:54 +01:00
Joey Orlando
6e5cb4e8a7
[UI] fix eslint/prettier warnings (#678)
* UI spring cleaning

- fix ~570 outstanding eslint warnings
- make eslint force user to correct warnings
- remove .css files that are not referenced
- remove dummy.tsx as it is not consumed anywhere
- remove a few functions that were "dead code" (ie. not consumed anywhere)
- remove commented out blocks of code that had no explanatory comments surrounding them

* add prettier to pre-commit configuration

* change ignoreRestSiblings to true

we have a few spots in the codebase where we destructure
an object key and then use something like ...restProps
setting this to true allows that

* upgrade from eslint 7.21.0 to 8.25.0
- add @grafana/eslint-config to dev dependencies and pre-commit eslint deps
- add @grafana/eslint-config peer dependencies to package.json

* fix remaining outstanding prettier warnings

* enable noUnusedLocals and noUnusedParameters and fix errors related to this

* make pre-commit complain about eslint warnings

* import from moment-timezone instead of moment

* fix react/display-name eslint warning

* add eslint-plugin-react-hooks to dev deps

this is a peer dependency from @grafana/eslint-config

* turn off react/prop-types

* temporarily turn off react-hooks/exhaustive-deps

add note that it will be turned back on and fixed in next PR

* fix unused import errors after rebase to dev

* fix more new prettier errors

* turn react/no-unescaped-entities eslint rule off

* address PR comment about useReducer

* remove includeTemplateGroup from src/components/AlertTemplates/AlertTemplatesForm.helper.tsx

* update arg typing for refreshPageError

* update handleSyncException typing

* fix strict equality in containers/IntegrationSettings/parts/Autoresolve.tsx

* enhance typing in components/AlertTemplates/AlertTemplatesForm.tsx

* revert small change per Maxim's comment
2022-10-24 20:27:03 +08:00
Michael Derynck
6b40f95033 World, meet OnCall!
Co-authored-by: Eve832 <eve.meelan@grafana.com>
    Co-authored-by: Francisco Montes de Oca <nevermind89x@gmail.com>
    Co-authored-by: Ildar Iskhakov <ildar.iskhakov@grafana.com>
    Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
    Co-authored-by: Julia <ferril.darkdiver@gmail.com>
    Co-authored-by: maskin25 <kengurek@gmail.com>
    Co-authored-by: Matias Bordese <mbordese@gmail.com>
    Co-authored-by: Matvey Kukuy <motakuk@gmail.com>
    Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
    Co-authored-by: Richard Hartmann <richih@richih.org>
    Co-authored-by: Robby Milo <robbymilo@fastmail.com>
    Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
    Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
    Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2022-06-03 08:09:47 -06:00