Skip to content

Commit

Permalink
Merge pull request #1 from codacy/first-version
Browse files Browse the repository at this point in the history
  • Loading branch information
alerizzo authored May 24, 2024
2 parents 3c8615c + 12f438f commit 58a0c97
Showing 18 changed files with 2,082 additions and 110 deletions.
34 changes: 34 additions & 0 deletions .codacyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"tools": [
{
"name": "lizard",
"patterns": [
{
"patternId": "ccn-medium",
"parameters": [
{
"name": "threshold",
"value": 3
}
]
},
{
"patternId": "ccn-critical",
"parameters": [
{
"name": "threshold",
"value": 8
}
]
}
]
}
],
"files": [
"/src/dist/src/configCreator.js",
"/src/dist/src/engineImpl.js",
"/src/dist/src/lizard.js",
"/src/dist/src/lizardIssuesEngine.js",
"/src/dist/src/logging.js"
]
}
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -39,12 +39,13 @@ module.exports = {
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unused-imports/no-unused-imports": "error",
"@stylistic/ts/block-spacing": ["error", "always"],
"@stylistic/operator-linebreak": ["error", "before"],
"@stylistic/ts/indent": ["error", 2],
"@stylistic/indent-binary-ops": ["error", 2],
"@stylistic/ts/semi": ["error", "never", {"beforeStatementContinuationChars": "never"}],
"@stylistic/multiline-ternary": ["error", "always-multiline"],
"@stylistic/ts/object-curly-spacing": ["error", "always", { "objectsInObjects": false, "arraysInObjects": false }],
"@stylistic/ts/object-curly-spacing": ["error", "always", { "objectsInObjects": true, "arraysInObjects": true }],
"@typescript-eslint/no-var-requires": "off"
},
overrides: [
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -6,4 +6,4 @@
.vscode
tsconfig.tsbuildinfo
/node_modules
/dist
/dist
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
FROM node:lts-alpine3.19 as builder
FROM node:lts-alpine3.20 as builder

COPY package.json package-lock.json ./

RUN npm install &&\
npm cache clean --force

COPY src src
# copy to test the build with docs
COPY docs docs
COPY tsconfig.json ./

RUN npm run build
RUN npm install &&\
npm run build

FROM python:3.9-alpine3.20

RUN pip install lizard &&\
apk add --no-cache nodejs npm

RUN adduser -u 2004 -D docker
apk add --no-cache nodejs &&\
adduser -u 2004 -D docker &&\
mkdir /codacy &&\
chown docker:docker /codacy

COPY package.json package-lock.json ./
COPY --from=builder --chown=docker:docker node_modules node_modules
COPY --from=builder --chown=docker:docker dist dist
COPY --from=builder --chown=docker:docker docs docs
COPY --chmod=+x entrypoint.sh entrypoint.sh
COPY --chmod=550 --chown=docker:docker entrypoint.sh entrypoint.sh

WORKDIR /src

22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# codacy-public-template
# codacy-lizard

Template repository for new public repositories.
## What is Codacy

[Codacy](https://www.codacy.com/) is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.

### Among Codacy’s features

- Identify new Static Analysis issues
- Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
- Auto-comments on Commits and Pull Requests
- Integrations with Slack, HipChat, Jira, YouTrack
- Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories

Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

### Free for Open Source

Codacy is free for Open Source projects.

## GitHub actions

141 changes: 141 additions & 0 deletions docs/patterns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"name": "lizard",
"version": "1.17.10",
"patterns": [
{
"patternId": "nloc-minor",
"level": "Info",
"category": "CodeComplexity",
"title": "Minor NLOC control - Number of Lines of Code (without comments)",
"description": "Check the number of lines of code (without comments) in a function. If the threshold is not met, raise a Minor issue. The default threshold is 20.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 20
}
],
"enabled": false
},
{
"patternId": "nloc-medium",
"level": "Warning",
"category": "CodeComplexity",
"title": "Medium NLOC control - Number of Lines of Code (without comments)",
"description": "Check the number of lines of code (without comments) in a function. If the threshold is not met, raise a Medium issue. The default threshold is 50.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 50
}
],
"enabled": true
},
{
"patternId": "nloc-critical",
"level": "Error",
"category": "CodeComplexity",
"title": "Critical NLOC control - Number of Lines of Code (without comments)",
"description": "Check the number of lines of code (without comments) in a function or logic block. If the threshold is not met, raise a Critical issue. The default threshold is 100.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 100
}
],
"enabled": true
},
{
"patternId": "ccn-minor",
"level": "Info",
"category": "CodeComplexity",
"title": "Minor Cyclomatic Complexity control",
"description": "Check the Cyclomatic Complexity value of a function or logic block. If the threshold is not met, raise a Minor issue. The default threshold is 4.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 4
}
],
"enabled": false
},
{
"patternId": "ccn-medium",
"level": "Warning",
"category": "CodeComplexity",
"title": "Medium Cyclomatic Complexity control",
"description": "Check the Cyclomatic Complexity value of a function or logic block. If the threshold is not met, raise a Medium issue. The default threshold is 7.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 7
}
],
"enabled": true
},
{
"patternId": "ccn-critical",
"level": "Error",
"category": "CodeComplexity",
"title": "Critical Cyclomatic Complexity control",
"description": "Check the Cyclomatic Complexity value of a function or logic block. If the threshold is not met, raise a Critical issue. The default threshold is 10.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 10
}
],
"enabled": true
},
{
"patternId": "parameter-count-minor",
"level": "Info",
"category": "CodeComplexity",
"title": "Minor Parameter count control",
"description": "Check the number of parameters sent to a function. If the threshold is not met, raise a Minor issue. The default threshold is 3.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 3
}
],
"enabled": false
},
{
"patternId": "parameter-count-medium",
"level": "Warning",
"category": "CodeComplexity",
"title": "Medium Parameter count control",
"description": "Check the number of parameters sent to a function. If the threshold is not met, raise a Medium issue. The default threshold is 5.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 5
}
],
"enabled": true
},
{
"patternId": "parameter-count-critical",
"level": "Error",
"category": "CodeComplexity",
"title": "Critical Parameter count control",
"description": "Check the number of parameters sent to a function. If the threshold is not met, raise a Critical issue. The default threshold is 9.",
"timeToFix": 5,
"parameters": [
{
"name": "threshold",
"default": 9
}
],
"enabled": true
}
]
}
1 change: 1 addition & 0 deletions docs/tool-description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Lizard is an extensible Cyclomatic Complexity Analyzer for many programming languages. [Learn more](https://github.com/terryyin/lizard)
Loading
Oops, something went wrong.

0 comments on commit 58a0c97

Please sign in to comment.