Skip to content

Commit d5a1000

Browse files
authored
Merge pull request #25 from drgrice1/code-formatting
Add a workflow to check code formatting.
2 parents fe40758 + cdba4cf commit d5a1000

40 files changed

+1976
-1657
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
max_line_length = 120
8+
trim_trailing_whitespace = true
9+
indent_style = tab
10+
indent_size = 4
11+
12+
[*.{yml,md}]
13+
indent_style = space
14+
indent_size = 2
15+
16+
[*.pg]
17+
trim_trailing_whitespace = false
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Check Formatting of Code Base
3+
4+
defaults:
5+
run:
6+
shell: bash
7+
8+
on:
9+
push:
10+
branches-ignore: [main, develop]
11+
pull_request:
12+
13+
jobs:
14+
perltidy:
15+
name: Check Perl file formatting with perltidy
16+
runs-on: ubuntu-24.04
17+
container:
18+
image: perl:5.38
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
- name: Install dependencies
23+
run: cpanm -n Perl::Tidy@20240903
24+
- name: Run perltidy
25+
shell: bash
26+
run: |
27+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
28+
shopt -s extglob globstar nullglob
29+
perltidy --pro=./.perltidyrc -b -bext='/' ./**/*.p[lm] ./**/*.t && git diff --exit-code
30+
31+
prettier:
32+
name: Check JavaScript, style, and HTML file formatting with prettier
33+
runs-on: ubuntu-24.04
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
- name: Install Node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: '20'
41+
- name: Install Dependencies
42+
run: cd public && npm ci --ignore-scripts
43+
- name: Check formatting with prettier
44+
run: cd public && npm run prettier-check

.github/workflows/createContainer.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,26 @@ name: Github Packages Release
33
on:
44
push:
55
branches:
6-
- main
7-
- development
6+
- main
7+
- development
88
tags:
9-
- v*
9+
- v*
1010

1111
jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
16+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
1717
- uses: actions/checkout@v2
1818
with:
1919
submodules: recursive
20-
20+
2121
- name: Extract branch/tag name
2222
shell: bash
2323
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
2424
id: extract_branch
25-
25+
2626
# make sure you have "Improved Container Support" enabled for both your personal and/or Organization accounts!
2727
- uses: pmorelli92/[email protected]
2828
name: Build and Publish latest service image

.gitignore

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
*.DS_Store
22
render_app.conf
33
lib/.pls-tmp-*
4-
lib/WeBWorK/htdocs/tmp/renderer/gif/*
5-
lib/WeBWorK/htdocs/tmp/renderer/images/*
6-
lib/WeBWorK/htdocs/DATA/*.json
7-
lib/WeBWorK/bin/*
8-
webwork-open-problem-library/
9-
private/
4+
webwork-open-problem-library
5+
private
106
tmp/*
117
!tmp/.gitkeep
128
logs/*

.perltidyrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# PBP .perltidyrc file
2+
-l=120 # Max line width is 120 cols
3+
-et=4 # Use tabs instead of spaces.
4+
-i=4 # Indent level is 4 cols
5+
-ci=4 # Continuation indent is 4 cols
6+
-b # Write the file inline and create a .bak file
7+
-vt=0 # Minimal vertical tightness
8+
-cti=0 # No extra indentation for closing brackets
9+
-pt=2 # Maximum parenthesis tightness
10+
-bt=1 # Medium brace tightness
11+
-sbt=1 # Medium square bracket tightness
12+
-bbt=1 # Medium block brace tightness
13+
-nsfs # No space before semicolons
14+
-nolq # Don't outdent long quoted strings
15+
-mbl=1 # Do not allow multiple empty lines
16+
-ce # Cuddled else
17+
-cb # Cuddled blocks
18+
-nbbc # Do not add blank lines before full length comments
19+
-nbot # No line break on ternary
20+
-nlop # No logical padding (this causes mixed tabs and spaces)
21+
-wn # Weld nested containers
22+
-xci # Extended continuation indentation

.prettierrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"printWidth": 120,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none"
8+
}

0 commit comments

Comments
 (0)