Skip to content

Commit

Permalink
doc: Don't count blank and comment lines
Browse files Browse the repository at this point in the history
  • Loading branch information
itislu committed Jul 25, 2024
1 parent b4acf73 commit fe54db3
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/lines_of_code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on :
branches:
- main
env:
BADGE_COLOR: 61A
CLOC_DIR : /home/runner/cloc
LINES_OF_CODE: 0
BADGE_COLOR : 61A

jobs:
lines_of_code:
Expand All @@ -17,28 +19,24 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v4

- name: Count lines
uses: shadowmoose/[email protected]
id : loc
with:
directory : ./
badge : ./doc/images/lines_of_code.svg
patterns : '**/*.c|**/*.h|**/Makefile|**/*.mk|**/*.py|**/*.yaml|**/*.sh|**/*.y|**/*.bnf'
badge_label: 'lines of code'
badge_color: ${{ env.BADGE_COLOR }}
badge_style: classic
debug : true
- name: Install cloc
run : |
git clone [email protected]:AlDanial/cloc.git ${{ env.CLOC_DIR }}
- name: Count lines by language
run : |
${{ env.CLOC_DIR }}/cloc --fmt=2 --include-lang='C,C/C++ Header,make,YAML,Python,Bourne Shell,Bourne Again Shell,yacc,Dockerfile' . | tee ${{ env.CLOC_DIR }}/cloc_output.txt
echo "LINES_OF_CODE=$(grep 'SUM:' ${{ env.CLOC_DIR }}/cloc_output.txt | awk '{print $5}')" >> "$GITHUB_ENV"
- name: Print the output
- name: Count lines by file
run : |
echo "Scanned: ${{ steps.loc.outputs.counted_files }}";
echo "Line Count: ${{ steps.loc.outputs.total_lines }}";
${{ env.CLOC_DIR }}/cloc --fmt=5 --include-lang='C,C/C++ Header,make,YAML,Python,Bourne Shell,Bourne Again Shell,yacc,Dockerfile' .
- name: Create badge
uses: RubbaBoy/BYOB@v1
with:
name : lines_of_code
label : 'lines of code'
status : ${{ steps.loc.outputs.total_lines }}
status : ${{ env.LINES_OF_CODE }}
color : ${{ env.BADGE_COLOR }}
github_token: ${{ github.token }}

0 comments on commit fe54db3

Please sign in to comment.