-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from imrehg/updates
Various updates
- Loading branch information
Showing
7 changed files
with
243 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import nox | ||
|
||
source_folders = ["src/"] | ||
project_folders = source_folders + ["tests/"] | ||
|
||
# Default sessions | ||
nox.options.sessions = ["lint", "test"] | ||
|
||
|
||
@nox.session | ||
def format(session): | ||
"""Run code formatting.""" | ||
session.run("poetry", "install", external=True) | ||
session.run("isort", *project_folders) | ||
session.run("black", *project_folders) | ||
|
||
|
||
@nox.session | ||
def lint(session): | ||
"""Run linting checks on the code.""" | ||
session.run("poetry", "install", "--with", "test", external=True) | ||
session.run("isort", "--check", *project_folders) | ||
session.run("black", "--check", *project_folders) | ||
session.run("flake8", *project_folders) | ||
session.run("mypy", *source_folders) | ||
session.run("bandit", "-r", *source_folders) | ||
|
||
|
||
@nox.session(python=["3.10", "3.11"]) | ||
def test(session): | ||
"""Run tests on the code.""" | ||
session.run("poetry", "install", "--with", "test", external=True) | ||
try: | ||
session.run("coverage", "run", "-m", "pytest") | ||
finally: | ||
session.run("coverage", "report", "-m") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,9 @@ | ||
# Will be dynamically filled | ||
__version__ = "0.0.0" | ||
from importlib.metadata import PackageNotFoundError, version | ||
|
||
try: | ||
__version__ = version("linkhub_prometheus_exporter") | ||
except PackageNotFoundError: | ||
# This package is not installed. | ||
__version__ = "unknown" | ||
finally: | ||
del PackageNotFoundError, version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters