Skip to content

Commit

Permalink
refactor: fix all pre-commit.ci linting errors (#1101)
Browse files Browse the repository at this point in the history
* build: add migration for ProjectRole db enum type

* fix: database model backrefs for DbUserRole --> (DbProject/DbUser)

* fix: add debug user to bypass auth during tests

* refactor: simplify project deletion endpoint /project/{id}

* test: add test for project deletion endpoint

* refactor: rename upload_multi_polygon --> custom_task_boundaries

* ci: disable markdownlint rule MD033 (allow inline html img resize)

* docs: update docs home page to use ref links

* refactor: fix all linting errors for code

* ci: add CONTRIBUTING.md to prettier ignore list

* docs: fix linting errors for all markdown docs

* refactor: rename LICENSE --> LICENSE.md

* refactor: update badges in readme

* docs: add allcontributors to badge table

* ci: add LICENSE.md to markdownlint ignore

* ci: update markdownlint ignore syntax for ci

* ci: add LICENSE.md to prettier ignore

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* style: revert prettier changes to LICENSE.md

* ci: update pre-commit hook versions

* docs: fix markdown linting errors after update

* ci: disable hadolint until bundled binary

* ci: do not run shellcheck on contrib dir

* ci: ignore SC2188,SC2143 from shellcheck

* refactor: fix lint errors for all shell/bash scripts

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
spwoodcock and pre-commit-ci[bot] authored Jan 17, 2024
1 parent f8cf65f commit da5c95f
Show file tree
Hide file tree
Showing 44 changed files with 1,153 additions and 885 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests/test_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e
########################################

# TODO read personal access token
# read -p
# read -erp
# GITHUB_TOKEN=input
# Feed to act using -s flag: -s GITHUB_TOKEN=input_personal_access_token

Expand Down
49 changes: 45 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ repos:

# Autoformat: Python code
- repo: https://github.com/psf/black
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black
files: ^src/backend/(?:.*/)*.*$
args: [--target-version=py39]

# Lint / autoformat: Python code
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.6"
rev: "v0.1.13"
hooks:
- id: ruff
files: ^src/backend/(?:.*/)*.*$
Expand All @@ -33,12 +33,53 @@ repos:
--no-error-on-unmatched-pattern,
"!chart/**",
"!CHANGELOG.md",
"!CONTRIBUTING.md",
"!LICENSE.md",
"!src/frontend/pnpm-lock.yaml",
]

# # Lint: Dockerfile (disabled until binary is bundled)
# - repo: https://github.com/hadolint/hadolint.git
# rev: v2.12.1-beta
# hooks:
# - id: hadolint
# args:
# [
# "--ignore=DL3008",
# "--ignore=DL3013",
# "--ignore=DL3018",
# "--ignore=DL3059",
# ]

# Lint: Bash scripts
- repo: https://github.com/openstack-dev/bashate.git
rev: 2.1.1
hooks:
- id: bashate
files: ^(?!.*(?:^|/)contrib(?:/|$)).*$

# Lint: Shell scripts
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
hooks:
- id: shellcheck
files: ^(?!.*(?:^|/)contrib(?:/|$)).*$
args: ["-x", "--exclude=SC2317,SC2188,SC2143"]

# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.37.0
rev: v0.38.0
hooks:
- id: markdownlint
args: [--fix, --ignore, CHANGELOG.md, --ignore, .github]
args:
[
--fix,
--disable,
MD033,
--ignore,
LICENSE.md,
--ignore,
CHANGELOG.md,
--ignore,
.github,
]
135 changes: 105 additions & 30 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# 📜 Code of conduct

(The latest version can be found at <https://www.hotosm.org/code-of-conduct>)
(The latest version can be found at [https://www.hotosm.org/code-of-conduct][1]

Welcome to Humanitarian OpenStreetMap Team. HOT is committed to providing a welcoming and safe environment for people of all races, gender identities, gender expressions, sexual orientations, physical abilities, physical appearances, socio-economic backgrounds, nationalities, ages, religions, and beliefs.
Welcome to Humanitarian OpenStreetMap Team. HOT is committed to providing a
welcoming and safe environment for people of all races, gender identities,
gender expressions, sexual orientations, physical abilities, physical
appearances, socio-economic backgrounds, nationalities, ages, religions, and
beliefs.

The HOT community principles are:

- **Be friendly and patient.** Be generous and kind in both giving and accepting critique. Critique is a natural and important part of our culture. Good critiques are kind, respectful, clear, and constructive, focused on goals and requirements rather than personal preferences. You are expected to give and receive criticism with grace. Be considerate in speech and actions, and actively seek to acknowledge and respect the boundaries of fellow attendees.
- **Be friendly and patient.** Be generous and kind in both giving and accepting
critique. Critique is a natural and important part of our culture. Good
critiques are kind, respectful, clear, and constructive, focused on goals and
requirements rather than personal preferences. You are expected to give and
receive criticism with grace. Be considerate in speech and actions, and
actively seek to acknowledge and respect the boundaries of fellow attendees.

- **Be welcoming.** We strive to be a community that welcomes and supports people of all backgrounds and identities. Some examples of behavior that contributes to creating a positive environment include:
- **Be welcoming.** We strive to be a community that welcomes and supports
people of all backgrounds and identities. Some examples of behavior that
contributes to creating a positive environment include:

- Using welcoming and inclusive language.

Expand All @@ -20,64 +31,128 @@ The HOT community principles are:

- Placing collective interest before your own interest.

- **Be considerate.** Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.

- **Be respectful.** Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the HOT community should be respectful when dealing with other members as well as with people outside the HOT community.

- **Be careful in your word choice.** We are a global community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to:
- **Be considerate.** Your work will be used by other people, and you in turn
will depend on the work of others. Any decision you take will affect users and
colleagues, and you should take those consequences into account when making
decisions. Remember that we're a world-wide community, so you might not be
communicating in someone else's primary language.

- **Be respectful.** Not all of us will agree all the time, but disagreement is
no excuse for poor behavior and poor manners. We might all experience some
frustration now and then, but we cannot allow that frustration to turn into a
personal attack. It’s important to remember that a community where people feel
uncomfortable or threatened is not a productive one. Members of the HOT
community should be respectful when dealing with other members as well as with
people outside the HOT community.

- **Be careful in your word choice.** We are a global community of
professionals, and we conduct ourselves professionally. Be kind to others. Do
not insult or put down other participants. Harassment and other exclusionary
behavior aren't acceptable. This includes, but is not limited to:

- Violent threats or language directed against another person.

- Discriminatory jokes and language.

- Posting sexually explicit or violent material.

- Posting (or threatening to post) other people's personally identifying information ("doxing").
- Posting (or threatening to post) other people's personally identifying
information ("doxing").

- Personal insults, especially those using racist or sexist terms.

- Unwelcome sexual attention.

- Advocating for, or encouraging, any of the above behavior.

- Repeated harassment of others. In general, if someone asks you to stop, then stop.

- **Assume all communications are positive.** Always remain polite, and assume good faith. It is surprisingly easy to misunderstand each other, be it online or in person, particularly in such a culturally diverse setting as ours. Misunderstandings are particularly easy to arise when we are in a rush, or otherwise distracted. Please ask clarifying questions before assuming that a communication was inappropriate.

- **When we disagree, try to understand why.** Disagreements, both social and technical, happen easily and often. It is important that we resolve such disagreements and differing views constructively. At times it can be hard to appreciate a viewpoint that contradicts your own perceptions. Instead of pushing back, try to understand where the other person is coming from, and don’t be afraid to ask questions. You can be most helpful if your own replies serve to clarify, rather than to escalate an issue. Also don’t forget that it can be easy to make mistakes, and allow for the possibility that the mistake may have been yours. When this happens it is better to resolve the issue together, and to learn from the experience together, than to place blame.

Original text courtesy of the [Speak Up! project](http://web.archive.org/web/20141109123859/http://speakup.io/coc.html).
- Repeated harassment of others. In general, if someone asks you to stop, then
stop.

- **Assume all communications are positive.** Always remain polite, and assume
good faith. It is surprisingly easy to misunderstand each other, be it online
or in person, particularly in such a culturally diverse setting as ours.
Misunderstandings are particularly easy to arise when we are in a rush, or
otherwise distracted. Please ask clarifying questions before assuming that a
communication was inappropriate.

- **When we disagree, try to understand why.** Disagreements, both social and
technical, happen easily and often. It is important that we resolve such
disagreements and differing views constructively. At times it can be hard to
appreciate a viewpoint that contradicts your own perceptions. Instead of pushing
back, try to understand where the other person is coming from, and don’t be
afraid to ask questions. You can be most helpful if your own replies serve to
clarify, rather than to escalate an issue. Also don’t forget that it can be
easy to make mistakes, and allow for the possibility that the mistake may have
been yours. When this happens it is better to resolve the issue together, and
to learn from the experience together, than to place blame.

Original text courtesy of the [Speak Up! project][1].

Further sources:

- [Ada Initiative: HOWTO design a code of conduct for your community](https://adainitiative.org/2014/02/18/howto-design-a-code-of-conduct-for-your-community/)
- [Ada Initiative: HOWTO design a code of conduct for your community][3]

- [Algorithm Club Code of Conduct](https://github.com/drtortoise/critical-algorithm-studies/blob/master/code-of-conduct.md)
- [Algorithm Club Code of Conduct][4]

- [American Red Cross GIS Team Code of Conduct](https://github.com/AmericanRedCross/team-code-of-conduct)
- [American Red Cross GIS Team Code of Conduct][5]

- [Contributor Covenant – A Code of Conduct for Open Source Projects](http://contributor-covenant.org/)
- [Contributor Covenant – A Code of Conduct for Open Source Projects][6]

- [Django Code of Conduct](https://www.djangoproject.com/conduct/)
- [Django Code of Conduct][7]

- [Mozilla Community Participation Guidelines](https://www.mozilla.org/en-US/about/governance/policies/participation/)
- [Mozilla Community Participation Guidelines][8]

- [Vox Media Code of Conduct](http://code-of-conduct.voxmedia.com/)
- [Vox Media Code of Conduct][9]

## Complaint Handling Process

As a first measure, it is preferable to work out issues directly with the people involved, or to work with other Community Members who can help you resolve the issue. This may take several forms:
As a first measure, it is preferable to work out issues directly with the people
involved, or to work with other Community Members who can help you resolve the
issue. This may take several forms:

- Talk with one another. Assume that communications are positive and that people are treating each other with respect. Cues about emotions are often lacking from digital communications. Many of our modes of digital communication tend towards brevity, which can be easier to interpret incorrectly as being negative.
- Talk with one another. Assume that communications are positive and that people
are treating each other with respect. Cues about emotions are often lacking
from digital communications. Many of our modes of digital communication tend
towards brevity, which can be easier to interpret incorrectly as being negative.

- Contact a representative of the [Community Working Group](https://www.hotosm.org/community/working-groups/), which exists to support the HOT Community. Representatives are available to discuss any concerns about behaviour within the community, or ideas to promote positive behaviours. You can email them at [community@hotosm.org](mailto:community@hotosm.org).
- Contact a representative of the [Community Working Group][10], which exists to
support the HOT Community. Representatives are available to discuss any
concerns about behaviour within the community, or ideas to promote positive
behaviours. You can email them at
[community@hotosm.org](mailto:community@hotosm.org).

- Contact a representative of the [Governance Working Group](https://www.hotosm.org/community/working-groups/), which drafted these recommendations and the CoC. Representatives are available to provide advice on particular scenarios, as well as on the processes around the CoC.
- Contact a representative of the [Governance Working Group][11], which drafted
these recommendations and the CoC. Representatives are available to provide
advice on particular scenarios, as well as on the processes around the CoC.

- Contact the HOT Chair of Voting Members.

- Contact a [HOT Board Member](https://www.hotosm.org/board). Board members are well versed in the community and its management. They can offer advice on your particular situation, and know the resources of the organization that may be available to you.
- Contact a [HOT Board Member][12]. Board members are well versed in the
community and its management. They can offer advice on your particular
situation, and know the resources of the organization that may be available to
you.

- Contact the HOT Community Partnerships Manager.

When these informal processes fail, or when a situation warrants an immediate response by HOT, you can evoke the **HOT Policy and Code of Conduct Complaint Handling Process**. This process was adopted by HOT Voting Members in 2016 to provide a more formal means of enforcement for our community standards. You start it by emailing [complaints@hotosm.org](mailto:compaints@hotosm.org) with a description of your complaint, your name, and the name of the offending party. All complaints will be considered confidential. The full process is described [here](https://docs.google.com/document/d/1xb-SPADtSbgwl6mAgglHMPHpknt-E7lKRoIcSbW431A/edit) .
When these informal processes fail, or when a situation warrants an immediate
response by HOT, you can evoke the
**HOT Policy and Code of Conduct Complaint Handling Process**.
This process was adopted by HOT Voting Members in 2016 to provide a more formal
means of enforcement for our community standards. You start it by emailing
[complaints@hotosm.org](mailto:compaints@hotosm.org) with a description of
your complaint, your name, and the name of the offending party.
All complaints will be considered confidential.
The full process is described [here][13] .

[1]: https://www.hotosm.org/code-of-conduct
[3]: https://adainitiative.org/2014/02/18/howto-design-a-code-of-conduct-for-your-community/
[4]: https://github.com/drtortoise/critical-algorithm-studies/blob/master/code-of-conduct.md
[5]: https://github.com/AmericanRedCross/team-code-of-conduct
[6]: http://contributor-covenant.org/
[7]: https://www.djangoproject.com/conduct/
[8]: https://www.mozilla.org/en-US/about/governance/policies/participation/
[9]: http://code-of-conduct.voxmedia.com/
[10]: https://www.hotosm.org/community/working-groups/
[11]: https://www.hotosm.org/community/working-groups/
[12]: https://www.hotosm.org/board
[13]: https://docs.google.com/document/d/1xb-SPADtSbgwl6mAgglHMPHpknt-E7lKRoIcSbW431A/edit
Loading

0 comments on commit da5c95f

Please sign in to comment.