Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement flake8-bandit rule S108 #1644

Merged
merged 10 commits into from Jan 5, 2023

Conversation

edgarrmondragon
Copy link
Contributor

@edgarrmondragon edgarrmondragon commented Jan 4, 2023

Releated: #1646

@edgarrmondragon edgarrmondragon marked this pull request as ready for review January 5, 2023 00:57

#[derive(Debug, Hash)]
pub struct Settings {
pub hardcoded_tmp_directory: Vec<String>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could consider just having hardcoded_tmp_directory (removing hardcoded_tmp_directory_extend from Settings), and then concatenating the two in From<Options>.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that makes sense.

#[test_case(CheckCode::S105, Path::new("S105.py"), Settings::default(), "S105"; "S105")]
#[test_case(CheckCode::S106, Path::new("S106.py"), Settings::default(), "S106"; "S106")]
#[test_case(CheckCode::S107, Path::new("S107.py"), Settings::default(), "S107"; "S107")]
#[test_case(CheckCode::S108, Path::new("S108.py"), Settings::default(), "S108_default"; "S108_0")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me. For other plugins, we tend to use the default, and create dedicated test-cases for overridden settings. But this is cool too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. These were a bit unreadable so I refactored them.

@charliermarsh charliermarsh merged commit 2f71bdf into astral-sh:main Jan 5, 2023
@edgarrmondragon edgarrmondragon deleted the bandit-s108 branch January 5, 2023 02:13
renovate bot added a commit to ixm-one/pytest-cmake-presets that referenced this pull request Jan 5, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [ruff](https://togithub.com/charliermarsh/ruff) | `^0.0.210` ->
`^0.0.211` |
[![age](https://badges.renovateapi.com/packages/pypi/ruff/0.0.211/age-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://badges.renovateapi.com/packages/pypi/ruff/0.0.211/adoption-slim)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://badges.renovateapi.com/packages/pypi/ruff/0.0.211/compatibility-slim/0.0.210)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://badges.renovateapi.com/packages/pypi/ruff/0.0.211/confidence-slim/0.0.210)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>charliermarsh/ruff</summary>

###
[`v0.0.211`](https://togithub.com/charliermarsh/ruff/releases/tag/v0.0.211)

[Compare
Source](https://togithub.com/charliermarsh/ruff/compare/v0.0.210...v0.0.211)

#### What's Changed

- Implement `SIM220` and `SIM221` by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1630
- Implement flake8-simplify SIM105 rule by
[@&#8203;messense](https://togithub.com/messense) in
[astral-sh/ruff#1621
- Fix `SIM105` by [@&#8203;harupy](https://togithub.com/harupy) in
[astral-sh/ruff#1633
- Adding my company to the "used in" category of the Readme. by
[@&#8203;colin99d](https://togithub.com/colin99d) in
[astral-sh/ruff#1631
- Implement flake8-bandit rule `S103` by
[@&#8203;edgarrmondragon](https://togithub.com/edgarrmondragon) in
[astral-sh/ruff#1636
- Rename flake8-bandit rules from plugins to checks by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1637
- Tweak Yoda condition message by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1638
- Note a few more incompatibilities by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1639
- Add task-tags & ignore-overlong-task-comments settings by
[@&#8203;not-my-profile](https://togithub.com/not-my-profile) in
[astral-sh/ruff#1550
- Add badge JSON by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1641
- Add Ruff badge to README by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1642
- DRY up unused import removal code by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1643
- Implement builtin import removal by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1645
- Move external licenses to separate directory by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1648
- Implement nested-if detection by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1649
- Implement flake8-bandit rule `S108` by
[@&#8203;edgarrmondragon](https://togithub.com/edgarrmondragon) in
[astral-sh/ruff#1644
- Implement nested with detection (SIM117) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1651
- Cancel outdated in-progress workflow automatically by
[@&#8203;messense](https://togithub.com/messense) in
[astral-sh/ruff#1652
- Implement flake8-simplify SIM107 by
[@&#8203;messense](https://togithub.com/messense) in
[astral-sh/ruff#1650
- Implement `SIM110` and `SIM111` (conversion to `any` and `all`) by
[@&#8203;charliermarsh](https://togithub.com/charliermarsh) in
[astral-sh/ruff#1653

**Full Changelog**:
astral-sh/ruff@v0.0.210...v0.0.211

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/ixm-one/pytest-cmake-presets).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC44MS4wIiwidXBkYXRlZEluVmVyIjoiMzQuODEuMCJ9-->

Signed-off-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants