Skip to content

Commit

Permalink
Fix typos and prettify MD/YAML files (#48)
Browse files Browse the repository at this point in the history
Found through these commands:
- codespell .
- prettier --write .
  • Loading branch information
kianmeng authored Aug 24, 2022
1 parent 4c162c3 commit 3cd4c00
Show file tree
Hide file tree
Showing 35 changed files with 259 additions and 216 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
- macos-latest
- windows-latest
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
steps:
- uses: actions/checkout@v2
- name: Set up Python
Expand Down
44 changes: 43 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Expand All @@ -7,117 +8,158 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

## [0.13.0] - 2022-08-09

### Added

- Support for Flake8 5 ([#45](https://github.com/dlint-py/dlint/issues/45))

### Changed

- Support `usedforsecurity=False` parameter to hashlib constructors ([#39](https://github.com/dlint-py/dlint/issues/39))

## [0.12.0] - 2021-10-27

### Added

- Support for Python 3.10
- Support for Flake8 4 ([#36](https://github.com/dlint-py/dlint/issues/36))

### Removed

- Support for Python 2.7 ([#3](https://github.com/dlint-py/dlint/issues/3))

## [0.11.0] - 2020-10-30

### Added

- Support for Python 3.9 ([#32](https://github.com/dlint-py/dlint/issues/32))

### Fixed

- False positive for `DUO107` when `xml.etree.ElementTree.{Element,SubElement}` used ([#28](https://github.com/dlint-py/dlint/issues/28))
- False positive for `DUO116` when `shell=False` used ([#31](https://github.com/dlint-py/dlint/pull/31))

### Removed

- Support for Python 3.5

## [0.10.3] - 2020-03-09

### Fixed

- False positive for `DUO138` when expressions aren't backtrackable ([#14](https://github.com/dlint-py/dlint/issues/14))

## [0.10.2] - 2020-02-19

### Changed

- Cache namespace results and minimize kwarg checks by grouping similar rules - ~500% speed up ([#18](https://github.com/dlint-py/dlint/issues/18))
- Only run linters that are selected - speed up depends on number of linters seleted ([#19](https://github.com/dlint-py/dlint/issues/19))
- Only run linters that are selected - speed up depends on number of linters selected ([#19](https://github.com/dlint-py/dlint/issues/19))

### Fixed

- The `--print-dlint-linters` flag on Windows ([#17](https://github.com/dlint-py/dlint/issues/17))

## [0.10.1] - 2020-01-21

### Fixed

- Crash in `DUO138` when malformed regular expression ([#15](https://github.com/dlint-py/dlint/issues/15))

## [0.10.0] - 2020-01-21

### Added

- `DUO137`: lint for insecure itsdangerous kwarg usage ([#36](https://github.com/duo-labs/dlint/issues/36))
- `DUO138`: lint for regular expression catastrophic backtracking in re module ([#41](https://github.com/duo-labs/dlint/issues/41))

### Fixed

- False positive for `DUO137` when kwarg missing ([#39](https://github.com/duo-labs/dlint/issues/39))

## [0.9.2] - 2019-11-21

### Fixed

- False negative with arbitrary depth from import alias in bad module attribute ([#32](https://github.com/duo-labs/dlint/issues/32))
- False negative with arbitrary depth from import wildcard in bad module attribute ([#33](https://github.com/duo-labs/dlint/issues/33))

## [0.9.1] - 2019-11-06

### Fixed

- False positive with `input` as variable name ([#31](https://github.com/duo-labs/dlint/issues/31))

## [0.9.0] - 2019-10-13

### Added

- `DUO116`: rule for `subprocess.run` ([#24](https://github.com/duo-labs/dlint/issues/24))
- The `--print-dlint-linters` command-line flag to print all Dlint linters ([#26](https://github.com/duo-labs/dlint/issues/26))
- `DUO136`: lint for insecure xmlsec usage ([#27](https://github.com/duo-labs/dlint/issues/27))

### Changed

- Visitor strategy to minimize node visits - ~25% speed up ([#28](https://github.com/duo-labs/dlint/issues/28))

### Fixed

- False negative with nested imports in bad module attribute ([#30](https://github.com/duo-labs/dlint/issues/30))

### Removed

- `dlint.linters.helpers.bad_kwarg_use`: use of `attribute_name` in favor of fully specified `module_path` ([#19](https://github.com/duo-labs/dlint/issues/19))
- `dlint.tree`: use of `kwarg_attribute` in favor of `kwarg_module_path` ([#21](https://github.com/duo-labs/dlint/issues/21))
- `dlint.linters.helpers.bad_name_attribute_use`: use of attribute list in favor of fully specified module path ([#20](https://github.com/duo-labs/dlint/issues/20))

## [0.8.0] - 2019-09-18

### Added

- Support for Python 3.8 ([#12](https://github.com/duo-labs/dlint/issues/12))
- `DUO134`: lint for insecure cryptography usage ([#6](https://github.com/duo-labs/dlint/issues/6))
- `DUO135`: lint for insecure defusedxml usage ([#5](https://github.com/duo-labs/dlint/issues/5))

### Deprecated

- `dlint.linters.helpers.bad_kwarg_use`: use of `attribute_name` in favor of fully specified `module_path` ([#19](https://github.com/duo-labs/dlint/issues/19))
- `dlint.tree`: use of `kwarg_attribute` in favor of `kwarg_module_path` ([#21](https://github.com/duo-labs/dlint/issues/21))
- `dlint.linters.helpers.bad_name_attribute_use`: use of attribute list in favor of fully specified module path ([#20](https://github.com/duo-labs/dlint/issues/20))

### Fixed

- False negative when deep imports are not fully specified in bad module attribute ([#1](https://github.com/duo-labs/dlint/issues/1))
- False negative - consider `async` functions in bad name attribute ([7bd249e](https://github.com/duo-labs/dlint/commit/7bd249e80a91f7c38f2c1f05045a826e0bef3246))
- False negative in various import scenarios when using `attribute_name` in bad kwarg ([#19](https://github.com/duo-labs/dlint/issues/19))
- False negative in various import scenarios when using `kwarg_attribute` in bad kwarg ([#21](https://github.com/duo-labs/dlint/issues/21))
- False negative in various import scenarios when using attribute list in bad name attribute ([#20](https://github.com/duo-labs/dlint/issues/20))

## [0.7.0] - 2019-08-24

### Added

- `DUO133`: lint for pycrypto usage ([#7](https://github.com/duo-labs/dlint/issues/7))

### Fixed

- False positive when bad builtin is overwritten by import ([#16](https://github.com/duo-labs/dlint/issues/16))
- False negative when bad module attribute uses import alias ([#2](https://github.com/duo-labs/dlint/issues/2))
- False positive when bad module attribute not imported ([#14](https://github.com/duo-labs/dlint/issues/14))

## [0.6.0] - 2019-08-12

### Added

- Support for Python 3.5 and 3.7 ([#9](https://github.com/duo-labs/dlint/issues/9))
- `DUO131`: lint for disabling urllib3 warnings
- `DUO132`: lint for disabling urllib3 HTTPS certification verification

### Removed

- `FormatStringLinter`, previously `DUO104`, as it was a disabled expirement ([#15](https://github.com/duo-labs/dlint/issues/15))

## [0.5.0] - 2019-07-17

### Added

- Initial public release of Dlint
22 changes: 11 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ knowledge. **Further, please check out our brief section on [developing](https:/

When adding new linters:

* New linters should be added to the `dlint/linters/` directory.
* Add a new file and class inheriting from `base.BaseLinter` for each new linter.
* Add a "pass-through" import of the new class to `dlint.linters.__init__.py`.
* Add the new class to `ALL` in `dlint.linters.__init__.py`.
* Add documentation link in `docs/README.md`.
* Add documentation file in `docs/linters/`.
* Ensure new rules are properly tested (high or complete test coverage).
* Ensure new code adheres to the style guide/linting process.
* Add new rule information to `CHANGELOG.md` under `Unreleased` section, `Added` sub-section.
- New linters should be added to the `dlint/linters/` directory.
- Add a new file and class inheriting from `base.BaseLinter` for each new linter.
- Add a "pass-through" import of the new class to `dlint.linters.__init__.py`.
- Add the new class to `ALL` in `dlint.linters.__init__.py`.
- Add documentation link in `docs/README.md`.
- Add documentation file in `docs/linters/`.
- Ensure new rules are properly tested (high or complete test coverage).
- Ensure new code adheres to the style guide/linting process.
- Add new rule information to `CHANGELOG.md` under `Unreleased` section, `Added` sub-section.

From here, please create a [pull request](https://github.com/dlint-py/dlint/pulls)
with your changes and wait for a review.
Expand All @@ -36,7 +36,7 @@ first. This issue should include a snippet of code for reproducing the bug.

E.g.

*I expected `dlint` to flag the following code for faulty use of the `foo` module:*
_I expected `dlint` to flag the following code for faulty use of the `foo` module:_

```
from bar import foo
Expand All @@ -46,7 +46,7 @@ widget = foo.baz(var)
send_result(widget)
```

*Please update `dlint` to catch this. Thanks!*
_Please update `dlint` to catch this. Thanks!_

After reporting the issue, if you'd like to help fix it, please create a
[pull request](https://github.com/dlint-py/dlint/pulls) with the
Expand Down
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Dlint is a tool for encouraging best coding practices and helping ensure Python
> aggressively pursue static code analysis. Even more valuable than the
> hundreds of serious bugs I have prevented with it is the change in mindset
> about the way I view software reliability and code quality.
>
> - [John Carmack, 2011](https://www.gamasutra.com/view/news/128836/InDepth_Static_Code_Analysis.php)
> For a static analysis project to succeed, developers must feel they benefit
> from and enjoy using it.
>
> - [Lessons from Building Static Analysis Tools at Google](https://cacm.acm.org/magazines/2018/4/226371-lessons-from-building-static-analysis-tools-at-google/fulltext)
For documentation and a list of rules see [docs](https://github.com/dlint-py/dlint/tree/master/docs).
Expand Down Expand Up @@ -65,8 +67,8 @@ $ python -m flake8 --select=DUO test.py
test.py:2:1: DUO105 use of "exec" is insecure
```

* *Why is this insecure? To learn more visit [`/docs/linters/DUO105.md`](https://github.com/dlint-py/dlint/blob/master/docs/linters/DUO105.md).*
* *Why `DUO`? Dlint was originally developed by the [Duo Labs](https://duo.com/blog/introducing-dlint-robust-static-analysis-for-python) team.*
- _Why is this insecure? To learn more visit [`/docs/linters/DUO105.md`](https://github.com/dlint-py/dlint/blob/master/docs/linters/DUO105.md)._
- _Why `DUO`? Dlint was originally developed by the [Duo Labs](https://duo.com/blog/introducing-dlint-robust-static-analysis-for-python) team._

The `--select=DUO` flag tells `flake8` to only run Dlint lint rules.

Expand All @@ -88,12 +90,12 @@ Dlint results can also be included inline in your editor for fast feedback.
This typically requires an editor plugin or extension. Here are some starting
points for common editors:

* Vim: [https://github.com/vim-syntastic/syntastic](https://github.com/vim-syntastic/syntastic)
* Emacs: [https://github.com/flycheck/flycheck](https://github.com/flycheck/flycheck)
* Sublime: [https://github.com/SublimeLinter/SublimeLinter-flake8](https://github.com/SublimeLinter/SublimeLinter-flake8)
* PyCharm: [https://foxmask.net/post/2016/02/17/pycharm-running-flake8/](https://foxmask.net/post/2016/02/17/pycharm-running-flake8/)
* Atom: [https://atom.io/packages/linter-flake8](https://atom.io/packages/linter-flake8)
* Visual Studio Code: [https://code.visualstudio.com/docs/python/linting#_flake8](https://code.visualstudio.com/docs/python/linting#_flake8)
- Vim: [https://github.com/vim-syntastic/syntastic](https://github.com/vim-syntastic/syntastic)
- Emacs: [https://github.com/flycheck/flycheck](https://github.com/flycheck/flycheck)
- Sublime: [https://github.com/SublimeLinter/SublimeLinter-flake8](https://github.com/SublimeLinter/SublimeLinter-flake8)
- PyCharm: [https://foxmask.net/post/2016/02/17/pycharm-running-flake8/](https://foxmask.net/post/2016/02/17/pycharm-running-flake8/)
- Atom: [https://atom.io/packages/linter-flake8](https://atom.io/packages/linter-flake8)
- Visual Studio Code: [https://code.visualstudio.com/docs/python/linting#\_flake8](https://code.visualstudio.com/docs/python/linting#_flake8)

# Integrating

Expand All @@ -107,11 +109,11 @@ Dlint's custom plugins are built on a [simple naming convention](https://packagi
and rely on [Python modules](https://docs.python.org/3/distutils/examples.html#pure-python-distribution-by-module).
To make a Dlint custom plugin use the following conventions:

* The Python module name **must** start with `dlint_plugin_`.
* The linter class name **must** start with `Dlint`.
* The linter class **should** inherit from `dlint.linters.base.BaseLinter`.
* If for some reason you'd like to avoid this, then you **must** implement
the `get_results` function appropriately and inherit from `ast.NodeVisitor`.
- The Python module name **must** start with `dlint_plugin_`.
- The linter class name **must** start with `Dlint`.
- The linter class **should** inherit from `dlint.linters.base.BaseLinter`.
- If for some reason you'd like to avoid this, then you **must** implement
the `get_results` function appropriately and inherit from `ast.NodeVisitor`.

See an [example plugin](https://github.com/dlint-py/dlint-plugin-example) for further details.

Expand Down
Loading

0 comments on commit 3cd4c00

Please sign in to comment.