1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00

Compare commits

..

5 Commits

Author SHA1 Message Date
Yury Shkoda
5a358330c0 Merge pull request #50 from sasjs/git-hooks
feat(git): enabled git hook enforcing conventional commits
2021-05-20 09:01:47 +03:00
Yury Shkoda
fa9e4136bc chore(lint): fixed linting 2021-05-20 08:58:25 +03:00
Yury Shkoda
0c9b23c51b feat(git): enabled git hook enforcing conventional commits 2021-05-20 08:54:36 +03:00
Allan Bowe
9daf8f8c82 Update README.md 2021-05-06 11:02:54 +03:00
Allan Bowe
7ed846e3aa setting macronameinmend to true in readme 2021-05-06 11:02:29 +03:00
7 changed files with 26 additions and 7 deletions

18
.git-hooks/commit-msg Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
RED="\033[1;31m"
GREEN="\033[1;32m"
# Get the commit message (the parameter we're given is just the path to the
# temporary file which holds the message).
commit_message=$(cat "$1")
if (echo "$commit_message" | grep -Eq "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z \-]+\))?!?: .+$") then
echo "${GREEN} ✔ Commit message meets Conventional Commit standards"
exit 0
fi
echo "${RED}❌ Commit message does not meet the Conventional Commit standard!"
echo "An example of a valid message is:"
echo " feat(login): add the 'remember me' button"
echo " More details at: https://www.conventionalcommits.org/en/v1.0.0/#summary"
exit 1

View File

@@ -16,7 +16,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
{
"noEncodedPasswords": true,
"hasDoxygenHeader": true,
"hasMacroNameInMend": false,
"hasMacroNameInMend": true,
"hasMacroParentheses": true,
"indentationMultiple": 2,
"lowerCaseFileNames": true,
@@ -46,7 +46,7 @@ The SASjs framework recommends the use of Doxygen headers for describing all typ
#### hasMacroNameInMend
The addition of the macro name in the `%mend` statement is optional, but can approve readability in large programs. A discussion on this topic can be found [here](https://www.linkedin.com/posts/allanbowe_sas-sasapps-sasjs-activity-6783413360781266945-1-7m). The default setting will be the result of a popular vote by around 300 people.
* Default: false (for now)
* Default: true
* Severity: WARNING
#### hasMacroParentheses

View File

@@ -8,7 +8,8 @@
"postpublish": "git clean -fd",
"package:lib": "npm run build && cp ./package.json build && cp README.md build && cd build && npm version \"5.0.0\" && npm pack",
"lint:fix": "npx prettier --write '{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
"lint": "npx prettier --check '{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'"
"lint": "npx prettier --check '{src,test}/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
"postinstall": "[ -d .git ] && git config core.hooksPath ./.git-hooks || true"
},
"publishConfig": {
"access": "public"

View File

@@ -59,7 +59,7 @@ describe('hasDoxygenHeader - test', () => {
it('should return an array with a single diagnostic when the file is undefined', () => {
const content = undefined
expect(hasDoxygenHeader.test((content as unknown) as string)).toEqual([
expect(hasDoxygenHeader.test(content as unknown as string)).toEqual([
{
message: 'File missing Doxygen header',
lineNumber: 1,

View File

@@ -114,7 +114,7 @@ describe('hasMacroNameInMend - test', () => {
it('should return an empty array when the file is undefined', () => {
const content = undefined
expect(hasMacroNameInMend.test((content as unknown) as string)).toEqual([])
expect(hasMacroNameInMend.test(content as unknown as string)).toEqual([])
})
describe('nestedMacros', () => {

View File

@@ -79,7 +79,7 @@ describe('hasMacroParentheses', () => {
it('should return an empty array when the file is undefined', () => {
const content = undefined
expect(hasMacroParentheses.test((content as unknown) as string)).toEqual([])
expect(hasMacroParentheses.test(content as unknown as string)).toEqual([])
})
describe('with extra spaces and comments', () => {

View File

@@ -72,7 +72,7 @@ describe('noNestedMacros', () => {
it('should return an empty array when the file is undefined', () => {
const content = undefined
expect(noNestedMacros.test((content as unknown) as string)).toEqual([])
expect(noNestedMacros.test(content as unknown as string)).toEqual([])
})
it('should use the configured line ending while testing content', () => {