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

✨ Add PRE_COMMAND to megalinter to install python dependencies before running linter #81

Merged
merged 7 commits into from
Jan 16, 2024

Conversation

connormaglynn
Copy link
Contributor

@connormaglynn connormaglynn commented Jan 16, 2024

👀 Purpose

  • To remove false positives of pylint errors
  • To enable pylint to check whether a module import is possible

♻️ What's changed

  • Add a precommand to install dependencies in the pylint virtual environment before lining is run

📝 Notes

  • Megalinter uses a different virtual environment per linter (which is nice isolation 📦 ) - but it does mean that we need to manually install dependencies before the linters run (if they require the dependencies to be installed to run)
  • The command used is a bit odd pip install -r /github/workspace/requirements.txt- essentially the working directory is the pylint virtual env, and /github/workspace is the root of our source code, where we need to go to get the requirements file

tamsinforbes
tamsinforbes previously approved these changes Jan 16, 2024
Copy link
Contributor

@tamsinforbes tamsinforbes left a comment

Choose a reason for hiding this comment

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

🧪

@tamsinforbes tamsinforbes dismissed their stale review January 16, 2024 14:18

approved by mistake

Copy link
Contributor

@tamsinforbes tamsinforbes left a comment

Choose a reason for hiding this comment

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

🌝🌖🚀LGTM🚀🌘🌚

@ministryofjustice ministryofjustice deleted a comment from github-actions bot Jan 16, 2024
Copy link
Contributor

github-actions bot commented Jan 16, 2024

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
✅ REPOSITORY gitleaks yes no 0.49s
❌ REPOSITORY trivy yes 1 4.86s
✅ YAML prettier 1 1 0 0.48s
❌ YAML yamllint 1 1 0.3s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

Comment on lines 16 to 17
def dummy_python_change_to_test_linter(self):
self.assertEqual(True, True)
Copy link
Member

Choose a reason for hiding this comment

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

I assume we don't need this anymore?

Copy link
Member

@jasonBirchall jasonBirchall left a comment

Choose a reason for hiding this comment

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

Nice one! 🚀

@connormaglynn connormaglynn merged commit 20c094c into main Jan 16, 2024
3 of 4 checks passed
@connormaglynn connormaglynn deleted the fix-pylint-import-errors branch January 16, 2024 16:32
jasonBirchall added a commit that referenced this pull request Jan 17, 2024
* main:
  Restored removed logic for displaying message
  Updated description on test config
  Corrected tag name on checkbox
  Added new test config
  Selectable organisations added to both development and production configuration files
  Logic added to determine the organisations to display
  ✨ Add `PRE_COMMAND` to install python dependencies before running MegaLinter (#81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants