Skip to content

This action provides many checks for Plone backend code

License

Notifications You must be signed in to change notification settings

plone/code-analysis-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Plone Code Analysis GitHub Actions

Plone Code Analysis Action

GitHub release (latest by date) GitHub Repo stars license badge

GitHub Action providing many checks for Plone backend code.

This action uses the Plone Code Quality tool docker image.

Inputs

check

Optional Type of check to run.

Possible checks:

  • black
  • isort
  • flake8
  • pyroma
  • zpretty

path

Optional Path to check.

base_dir

Base dir inside the repo.

log_level

Sets the logging verbosity. Default INFO

Examples

Run all checks

Considering your codebase has a pyproject.toml with settings like:

[tool.plone-code-analysis]
checkers = ["black", "flake8", "isort", "pyroma", "zpretty"]
paths = "src"

Adding a workflow with the following configuration:

name: Backend Code Analysis

on: push

  checks:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run checks
        uses: plone/code-analysis-action@v2

will run all checks on the src folder of the codebase.

Read about all possible configuration options on Plone Code Quality tool documenation.

Run one check, default paths

name: Backend Code Analysis

on: push

jobs:

  black:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run check
        uses: plone/code-analysis-action@v2
        with:
          base_dir: 'backend'
          check: 'black'

Run one check, providing paths

name: Backend Code Analysis

on: push

jobs:

  black:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run check
        uses: plone/code-analysis-action@v2
        with:
          base_dir: 'backend'
          check: 'black'
          path: |
            src/ploneconf.core/src
            src/ploneconf.core/setup.py
            scripts

Codebase in a sub-directory of the codebase

name: Backend Code Analysis

on:
  push:
    paths:
      - "backend/**"

jobs:

  black:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run check
        uses: plone/code-analysis-action@v2
        with:
          base_dir: 'backend'
          check: 'black'
          path: |
            src/ploneconf.core/src
            src/ploneconf.core/setup.py
            scripts

  flake8:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run check
        uses: plone/code-analysis-action@v2
        with:
          base_dir: 'backend'
          check: 'flake8'
          path: |
            src/ploneconf.core/src
            src/ploneconf.core/setup.py
            scripts

  isort:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run check
        uses: plone/code-analysis-action@v2
        with:
          base_dir: 'backend'
          check: 'isort'
          path: |
            src/ploneconf.core/src
            src/ploneconf.core/setup.py
            scripts

  zpretty:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v2

      - name: Run check
        uses: plone/code-analysis-action@v2
        with:
          base_dir: 'backend'
          check: 'zpretty'
          path: src/ploneconf.core/src

Contribute

Please DO NOT commit to version branches directly. Even for the smallest and most trivial fix.

ALWAYS open a pull request and ask somebody else to merge your code. NEVER merge it yourself.

Credits

Based on a solution originally developed by kitconcept GmbH.

Plone Foundation

License

The project is licensed under the GPLv2.

About

This action provides many checks for Plone backend code

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published