Skip to content

Commit

Permalink
initial add of pre-commit tool for linting source
Browse files Browse the repository at this point in the history
* add basic source checks for existing file types
* commit fixes from auto-corrections (eoln and eof fixes)
* add github action to run pre-commit hooks in CI

Signed-off-by: Kevin Broch <[email protected]>
  • Loading branch information
kbroch-rivosinc committed Jan 18, 2024
1 parent 673be9f commit 53c5475
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-pdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
description: 'Release version, e.g. X.Y.Z:'
required: true
type: string
revision_mark:
revision_mark:
description: 'Set revision mark as Draft, Release or Stable:'
required: true
type: string
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
name: Build Artifacts
path: ${{ github.workspace }}/*.pdf
retention-days: 30

# Create Release
- name: Create Release
uses: softprops/action-gh-release@v1
Expand All @@ -69,5 +69,5 @@ jobs:
prerelease: ${{ github.event.inputs.prerelease }}
env:
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
if: github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch'
# This condition ensures this step only runs for workflow_dispatch events.
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.pdf

10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-json
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ You can manually add the DCO text to your commit body or include either -s or --

Note:

Ensure that the name and email address associated with your GitHub account match the name and email address in the Signed-off-by line of your commit message.
Ensure that the name and email address associated with your GitHub account match the name and email address in the Signed-off-by line of your commit message.
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exhaustive, and do not form part of our licenses.
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
for the public:
wiki.creativecommons.org/Considerations_for_licensees

=======================================================================
Expand Down Expand Up @@ -393,4 +393,3 @@ the avoidance of doubt, this paragraph does not form part of the
public licenses.

Creative Commons may be contacted at creativecommons.org.

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# SPDX-License-Identifier: CC-BY-SA-4.0
#
# Description:
#
# This Makefile is designed to automate the process of building and packaging
#
# This Makefile is designed to automate the process of building and packaging
# the Doc Template for RISC-V Extensions.

DATE ?= $(shell date +%Y-%m-%d)
Expand Down Expand Up @@ -39,7 +39,7 @@ REQUIRES := --require=asciidoctor-bibtex \

all: build

build:
build:
@echo "Checking if Docker is available..."
@if command -v docker >/dev/null 2>&1 ; then \
echo "Docker is available, building inside Docker container..."; \
Expand Down
2 changes: 1 addition & 1 deletion example.bib
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ @article{spur-jsscc1989
number = {6},
pages = {1688-1698},
month = {December}
}
}

0 comments on commit 53c5475

Please sign in to comment.