Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 0 additions & 70 deletions .github/workflows/codeql-analysis.yml.disabled

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: "true"
github-token: ${{ github.token }}
- uses: extractions/setup-just@v3
- name: Running type checking
run: |
make types
just lint
5 changes: 3 additions & 2 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: "true"
github-token: ${{ github.token }}
- name: Running ruff
- name: Running ruff checks
run: |
uv run ruff check $(basename $(pwd)) tests
just format
3 changes: 2 additions & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: "true"
github-token: ${{ github.token }}
- name: Running pytest
run: |
uv run python -m pytest -m 'not network'
just test -m 'not\ network'
17 changes: 9 additions & 8 deletions CLAUDE.md → AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

github_linter is a Python tool for auditing GitHub repositories at scale. It scans repositories for common configuration issues, missing files, and standardization opportunities across multiple repos.

**MANDATORY** You are not finished with a task until running `just check` passes without warnings or errors.

## Development Commands

### Testing and Linting

- Run all precommit checks: `make precommit`
- Run linting: `make ruff`
- Run type checking: `make types`
- Run tests: `make test`
- Run all precommit checks: `just check`
- Run linting: `just ruff`
- Run type checking: `just lint`
- Run tests: `just test`
- Run single test: `uv run pytest tests/test_<module>.py::<test_name>`

### Running the CLI
Expand All @@ -26,13 +28,12 @@ github_linter is a Python tool for auditing GitHub repositories at scale. It sca

### Web Interface

- Start web server: `uv run github-linter-web`
- Or use the script: `./run_web.sh`
- Start web server: `./run_web.sh`

### Docker

- Build container: `make docker_build`
- Run web server in container: `make docker_run`
- Build container: `just docker_build`
- Run web server in container: `just docker_run`

## Architecture

Expand Down
43 changes: 0 additions & 43 deletions Makefile

This file was deleted.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,9 @@ docker run --rm -it \
ghcr.io/yaleman/github_linter:latest \
python -m github_linter.web
```

## Thanks

* [Vue.js](http://vuejs.org) used in the UI
* [Pico](https://picocss.com) CSS framework.

38 changes: 38 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
"files": {
"includes": [
"github_linter/**/*.js",
"github_linter/**/*.css",
"!!.venv/",
"!!**/pico.min.css"
]
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"javascript": {
"formatter": {
"lineWidth": 80
}
},
"overrides": [
{
"includes": ["*.vue"],
"linter": {
"enabled": true
},
"formatter": {
"enabled": true
}
}
]
}
2 changes: 1 addition & 1 deletion github_linter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def filter_by_repo(repo_list: List[Repository], repo_filters: List[str]) -> List
return retval


class RepoSearchString(pydantic.BaseModel): # pylint: disable=no-member
class RepoSearchString(pydantic.BaseModel):
"""Result of running generate_repo_search_string"""

needs_post_filtering: bool
Expand Down
1 change: 0 additions & 1 deletion github_linter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
@click.option("--check", "-k", multiple=True, help="Filter by check name, eg check_example")
@click.option("--list-repos", is_flag=True, default=False, help="List repos and exit")
@click.option("--debug", "-d", is_flag=True, default=False, help="Enable debug logging")
# pylint: disable=too-many-arguments,too-many-locals
def cli(
repo: Optional[Tuple[str]] = None,
owner: Optional[Tuple[str]] = None,
Expand Down
2 changes: 1 addition & 1 deletion github_linter/custom_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Custom types """
"""Custom types"""

from typing import Dict, List

Expand Down
2 changes: 1 addition & 1 deletion github_linter/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" default linter configuration goes here """
"""default linter configuration goes here"""

from typing import Dict, List, Optional, TypedDict

Expand Down
6 changes: 1 addition & 5 deletions github_linter/fixes/github_actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def get_repo_default_workflow_permissions(

# https://docs.github.com/en/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-a-repository

# pylint: disable=protected-access
resp = repo.repository3._get(
f"https://api.github.com/repos/{repo.repository3.owner}/{repo.repository3.name}/actions/permissions/workflow",
)
Expand All @@ -51,16 +50,13 @@ def set_repo_default_workflow_permissions(
# https://docs.github.com/en/rest/actions/permissions?apiVersion=2022-11-28#set-default-workflow-permissions-for-a-repository

if default_workflow_permissions not in VALID_DEFAULT_WORKFLOW_PERMISSIONS:
raise ValueError(
f"Invalid default_workflow_permissions: {default_workflow_permissions}. Valid values are: {VALID_DEFAULT_WORKFLOW_PERMISSIONS}"
)
raise ValueError(f"Invalid default_workflow_permissions: {default_workflow_permissions}. Valid values are: {VALID_DEFAULT_WORKFLOW_PERMISSIONS}")

payload = {
"default_workflow_permissions": default_workflow_permissions,
"can_approve_pull_request_reviews": can_approve_pull_request_reviews,
}

# pylint: disable=protected-access
res: Response = repo.repository3._put(
f"https://api.github.com/repos/{repo.repository3.owner}/{repo.repository3.name}/actions/permissions/workflow",
data=json.dumps(payload),
Expand Down
6 changes: 2 additions & 4 deletions github_linter/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ def load_yaml_file(
if not fileresult:
return {}
try:
filecontents: Dict[Any, Any] = YAML(pure=True).load(
fileresult.decoded_content.decode("utf-8")
)
filecontents: Dict[Any, Any] = YAML(pure=True).load(fileresult.decoded_content.decode("utf-8"))
return filecontents
except Exception as error_message: # pylint: disable=broad-except
except Exception as error_message:
logger.error("Failed to parse yaml file {}: {}", filename, error_message)
# TODO: Catch a better exception in loaders.load_yaml_file
return None
1 change: 0 additions & 1 deletion github_linter/repolinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ def cached_get_file(self, filepath: str, clear_cache: bool = False) -> Optional[
return None
return self.filecache[filepath]

# pylint: disable=too-many-branches
def create_or_update_file(
self,
filepath: str,
Expand Down
1 change: 0 additions & 1 deletion github_linter/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
homebrew, # noqa: F401
issues, # noqa: F401
mkdocs, # noqa: F401
# pylintrc,
pyproject, # noqa: F401
security_md, # noqa: F401
terraform, # noqa: F401
Expand Down
1 change: 0 additions & 1 deletion github_linter/tests/dependabot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def generate_expected_update_config(
return config_file


# pylint: disable=too-many-branches
def check_updates_for_languages(repo: RepoLinter) -> None:
"""ensures that for every known language/package ecosystem, there's a configured update task"""

Expand Down
2 changes: 1 addition & 1 deletion github_linter/tests/dependabot/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" github_linter dependabot tests constants """
"""github_linter dependabot tests constants"""

from typing import Dict, List

Expand Down
Loading