Skip to content

Commit

Permalink
Add pre-commit & codespell (#155)
Browse files Browse the repository at this point in the history
* Add pre-commit

* Ignore "recuse"

* Pre-commit
  • Loading branch information
kenodegard authored Aug 2, 2024
1 parent b634b5d commit 50c441d
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/meeting-notes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ on:
Common examples are "now", "tomorrow", "next Wednesday", "2023-03-01"...
See https://www.gnu.org/software/coreutils/manual/html_node/Date-input-formats.html for full details.
required: false
default: "now"
default: now
type: string
schedule:
# this is every wednesday, but we want every two! check 'pre-create' job below
- cron: "00 12 * * WED"
- cron: 00 12 * * WED
pull_request:
types:
- labeled
Expand Down
65 changes: 65 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# disable autofixing PRs, commenting "pre-commit.ci autofix" on a pull request triggers a autofix
ci:
autofix_prs: false
# ignore meeting notes since they are synced as is from HackMD
exclude: |
(?x)^(
meetings/archive
)/
repos:
# generic verification and formatting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# standard end of line/end of file cleanup
- id: mixed-line-ending
- id: end-of-file-fixer
- id: trailing-whitespace
# ensure syntaxes are valid
- id: check-toml
- id: check-yaml
# catch git merge/rebase problems
- id: check-merge-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.5
hooks:
# lint & attempt to correct failures (e.g. pyupgrade)
- id: ruff
args: [--fix]
# compatible replacement for black
- id: ruff-format
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.14.0
hooks:
- id: pretty-format-toml
args: [--autofix, --trailing-commas]
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
# ruamel.yaml doesn't line wrap correctly (?) so set width to 1M to avoid issues
args: [--mapping=2, --offset=2, --sequence=4, --width=1000000, --implicit_start]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
hooks:
# verify github syntaxes
- id: check-github-workflows
- repo: https://github.com/codespell-project/codespell
# see pyproject.toml
rev: v2.3.0
hooks:
- id: codespell
args: [--write-changes]
- repo: meta
# see https://pre-commit.com/#meta-hooks
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
- repo: local
hooks:
- id: git-diff
name: git diff
entry: git diff --exit-code
language: system
pass_filenames: false
always_run: true
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ The reporting form supports anonymous incident reporting. Anonymous reporting w

## Conflicts of Interest

Committee members are expected to recuse themselves if they have a conflict of interest, and are required to recuse themselves if they are the accused or the target of the reported behavior. In addition, the CoC Committee can [vote](#voting-and-decision-making) to remove a committee member from a case, if the committee feels that the member has a conflict of interest. This [vote](#voting-and-decision-making) requires a simple majority.
Committee members are expected to recuse themselves if they have a conflict of interest, and are required to recuse themselves if they are the accused or the target of the reported behavior. In addition, the CoC Committee can [vote](#voting-and-decision-making) to remove a committee member from a case, if the committee feels that the member has a conflict of interest. This [vote](#voting-and-decision-making) requires a simple majority. <!-- codespell:ignore recuse -->

If you are concerned about making a report that will be read by all committee members, you are strongly encouraged to contact [individual committee members](#committee-membership) directly.

Expand Down
1 change: 0 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -393,4 +393,3 @@ the avoidance of doubt, this paragraph does not form part of the
public licenses.

Creative Commons may be contacted at creativecommons.org.

3 changes: 1 addition & 2 deletions meetings/agenda_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
tags: [meeting-notes]
---
# {{ date.strftime("%Y-%m-%d") }} Conda Community Meeting
# {{ date.strftime("%Y-%m-%d") }} Conda Community Meeting

[Zoom link](https://zoom.us/j/9138593505?pwd=SWh3dE1IK05LV01Qa0FJZ1ZpMzJLZz09) · [What time is the meeting in my time zone](https://dateful.com/convert/utc?t=5pm)

Expand Down Expand Up @@ -35,4 +35,3 @@ X people in total
## New Agenda Items

- [ ]

12 changes: 6 additions & 6 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[dependencies]
python = ">=3.12.4,<3.13"

[project]
name = "governance"
version = "0.1.0"
description = "Add a short description here"
authors = ["Wolf Vollprecht <[email protected]>"]
channels = ["conda-forge"]
description = "Add a short description here"
name = "governance"
platforms = ["osx-arm64"]
version = "0.1.0"

[tasks]
vote_markdown = "python to_vote.py"

[dependencies]
python = ">=3.12.4,<3.13"
24 changes: 13 additions & 11 deletions to_vote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,38 @@
import io
from pathlib import Path


def csv_to_markdown(csv_data):
# Create a StringIO object to simulate a file
csv_file = io.StringIO(csv_data)

# Read the CSV data
csv_reader = csv.DictReader(csv_file)

# Start the Markdown output
markdown_output = "# GitHub Users Selection List\n\n"

# Process each row
for row in csv_reader:
github_username = row['github_username']
name = row['name']
github_username = row["github_username"]
name = row["name"]

# Build the Markdown line
line = f"@{github_username} ({name})\n"
line += "- [ ] yes\n"
line += "- [ ] no\n"
line += "- [ ] abstain\n"

markdown_output += line + "\n"

return markdown_output


if __name__ == "__main__":
# Read the CSV file
csv_data = Path("steering.csv").read_text()

# Convert the CSV data to Markdown
markdown_output = csv_to_markdown(csv_data)
print(markdown_output)

print(markdown_output)

0 comments on commit 50c441d

Please sign in to comment.