Giter Club home page Giter Club logo

Comments (7)

jku avatar jku commented on June 24, 2024

PR for flake8-bandit: #2571

from python-tuf.

rschulm avatar rschulm commented on June 24, 2024

Hello @jku , could you assign this issue to me? I am new to OSS and Git, and am looking to do my first few pull requests.

from python-tuf.

jku avatar jku commented on June 24, 2024

Thanks, PRs are welcome!

I won't assign this issue since it's probably 10+ PRs altogether

  • You can pick any ruleset from the list and try enabling that -- feel free to pick another if the first one seems too tricky (there's a lot of variance in complexity)
  • You can leave a comment here mentioning which ruleset you are enabling (but you don't have to)
  • If you encounter situations where you need help, file an issue as described above or ask at slack channel (link is in README)

from python-tuf.

jku avatar jku commented on June 24, 2024

After all PRs linked here, we currently break 44 unique rules from 16 rulesets (using current ignore list) -- so we're getting closer to being able to enable everything and then ignoring individual rulesets or rules

for reference: this is what the statistics look like (how many times each rule is broken):

276	FA100  	[ ] Missing `from __future__ import annotations`, but uses `typing.Dict`
237	PT009  	[ ] Use a regular `assert` instead of unittest-style `assertDictEqual`
236	COM812 	[*] Trailing comma missing
151	PT027  	[ ] Use `pytest.raises` instead of unittest-style `assertRaises`
144	PTH118 	[ ] `os.path.join()` should be replaced by `Path` with `/` operator
110	TRY003 	[ ] Avoid specifying long messages outside the exception class
 61	EM102  	[*] Exception must not use an f-string literal, assign to variable first
 49	EM101  	[*] Exception must not use a string literal, assign to variable first
 37	RUF012 	[ ] Mutable class attributes should be annotated with `typing.ClassVar`
 32	PTH123 	[ ] `open()` should be replaced by `Path.open()`
 22	PTH107 	[ ] `os.remove()` should be replaced by `Path.unlink()`
 16	PTH102 	[ ] `os.mkdir()` should be replaced by `Path.mkdir()`
 15	T201   	[*] `print` found
 14	FBT003 	[ ] Boolean positional value in function call
 12	BLE001 	[ ] Do not catch blind exception: `Exception`
 12	FBT002 	[ ] Boolean default positional argument in function definition
 11	TRY004 	[ ] Prefer `TypeError` exception for invalid type
 10	FBT001 	[ ] Boolean-typed positional argument in function definition
  8	ERA001 	[*] Found commented-out code
  8	PTH109 	[ ] `os.getcwd()` should be replaced by `Path.cwd()`
  6	RUF005 	[*] Consider `[*cmd, "--no-binary", PYPI_PROJECT, PYPI_PROJECT]` instead of concatenation
  5	INP001 	[ ] File `examples/manual_repo/basic_repo.py` is part of an implicit namespace package. Add an `__init__.py`.
  5	TRY301 	[ ] Abstract `raise` to an inner function
  4	RUF003 	[ ] Comment contains ambiguous `’` (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
  4	RUF100 	[*] Unused `noqa` directive (unused: `D102`)
  3	FIX002 	[ ] Line contains TODO, consider resolving the issue
  3	FIX004 	[ ] Line contains HACK, consider resolving the issue
  3	TD002  	[ ] Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...`
  3	TD003  	[ ] Missing issue link on the line following this TODO24
  3	PTH120 	[ ] `os.path.dirname()` should be replaced by `Path.parent`
  3	PERF203	[ ] `try`-`except` within a loop incurs performance overhead
  3	PERF401	[ ] Use a list comprehension to create a transformed list
  3	TRY201 	[*] Use `raise` without specifying exception name
  3	TRY300 	[ ] Consider moving this statement to an `else` block
  2	G003   	[ ] Logging statement uses `+`
  2	PTH103 	[ ] `os.makedirs()` should be replaced by `Path.mkdir(parents=True)`
  2	PTH110 	[ ] `os.path.exists()` should be replaced by `Path.exists()`
  1	TD004  	[ ] Missing colon in TODO
  1	PTH100 	[ ] `os.path.abspath()` should be replaced by `Path.resolve()`
  1	PTH105 	[ ] `os.replace()` should be replaced by `Path.replace()`
  1	PTH112 	[ ] `os.path.isdir()` should be replaced by `Path.is_dir()`
  1	PTH119 	[ ] `os.path.basename()` should be replaced by `Path.name`
  1	PTH207 	[ ] Replace `glob` with `Path.glob` or `Path.rglob`
  1	RUF010 	[*] Use explicit conversion flag

from python-tuf.

jku avatar jku commented on June 24, 2024

I'm removing "good first issue" as the low hanging fruit may be handled by now: PRs are still welcome

I think we want to ignore some rulesets completely, like:

  • PTH: I don't think going to pathlib is worth the trouble, at least in one go
  • FIX: these seem a bit weird
  • TDO: these seem a bit weird
  • PT: We don't use pytest

Rulesets we likely still want:

  • RUF
  • FA
  • ?

from python-tuf.

jku avatar jku commented on June 24, 2024

after the two PRs currently open we might be pretty much done...

"FA" might still be nice but I think that should be done by refactoring the code base to actually use from __future__ import annotations. I'm no sure how automatic that refactor is with ruff check --fix...

from python-tuf.

jku avatar jku commented on June 24, 2024

I think I'll close this as complete and open a new one about using ruff with "ALL" (excluding the ones we don't want)

from python-tuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.