Commitlint not working. git commit -m commitlint message showing unknown argument , husky existed with code 1 (error) - husky

git commit -m "feat: testing the commitlint library"
#commitlint/cli#16.2.3 - Lint your commit messages
[input] reads from stdin if --edit, --env, --from and --to are omitted
Options:
-c, --color toggle colored output [boolean] [default: true]
-g, --config path to the config file [string]
--print-config print resolved config [boolean] [default: false]
-d, --cwd directory to execute in
[string] [default: (Working Directory)]
-e, --edit read last commit message from the specified file or
fallbacks to ./.git/COMMIT_EDITMSG [string]
-E, --env check message in the file at path given by environment
variable value [string]
-x, --extends array of shareable configurations to extend [array]
-H, --help-url help url in error message [string]
-f, --from lower end of the commit range to lint; applies if
edit=false [string]
-o, --format output format of the results [string]
-p, --parser-preset configuration preset to use for
conventional-commits-parser [string]
-q, --quiet toggle console output [boolean] [default: false]
-t, --to upper end of the commit range to lint; applies if
edit=false [string]
-V, --verbose enable verbose output for reports without problems
[boolean]
-v, --version display version information [boolean]
-h, --help Show help [boolean]
Unknown argument: edit
husky - commit-msg hook exited with code 1 (error)

for Windows OS
I later solve the problem by going to my .husky folder and edit npx --no -- commitlint edit to npm commitlint --edit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no -- commitlint edit
to
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx commitlint --edit

Related

How to run docker-compose up --build silently

The command docker-compose up --build will output build process and options like --quiet, --quiet-pull or --log-level ERROR won't work.
I also didn't find any other options in the documents.
Any help is appreciated.
If you are on linux:
docker-compose up --build 2>&1 1>/dev/null
If you are on Windows:
docker-compose up --build > nul 2> nul

"This script must be sourced, not executed. Run it like: source /bin/bash"

I am running a docker container, in which I am trying to source a .sh file.
To reproduce the experience, if you have docker, it's very easy:
$ docker run -i -t conda/miniconda3 /bin/bash
# apt-get update
# apt-get install git
# git clone https://github.com/guicho271828/latplan.git
# cd latplan
# source ./install.sh
Doing this, gives this error:
This script must be sourced, not executed. Run it like: source /bin/bash
I have looked on other posts but I could not find a solution.
Any idea?
Many thanks!
[EDIT]
This is the begining of the install.sh file:
#!/bin/bash
env=latplan
# execute it in a subshell so that set -e stops on error, but does not exit the parent shell.
(
set -e
(conda activate >/dev/null 2>/dev/null) || {
echo "This script must be sourced, not executed. Run it like: source $0"
exit 1
}
conda env create -n $env -f environment.yml || {
echo "installation failed; cleaning up"
conda env remove -n $env
exit 1
}
conda activate $env
git submodule update --init --recursive
ok, I just removed the 1st checking, and it's working fine

How to run Pangolin tool with Docker correctly?

#!/bin/bash
BIN_VERSION="1.1.0"
sudo docker run -v /home/manager/data --rm staphb/pangolin pangolin test1.fasta -o PANGOLIN_DATA
I receive error: Use "gofasta sam [command] --help" for more information about a command.
2.18-r1015
5.13.0
Error: cannot find query (input) fasta file at /data/test1.fasta
Please enter your fasta sequence file and refer to pangolin usage at:
https://github.com/hCoV-2019/pangolin#usage

Failed to load codeclimate report, but report exists

in gitlab, I have a pipeline which generate a code climate report, supposed to be displayed in the gitlab widget.
The report is successfully generated (I added cat code-quality.json but I have the message «Failed to load codeclimate report».
When I check the source code of the gitlab page, I see a string which seems to contains the code responsible of the problem:
window.gl.mrWidgetData = { … ,"codeclimate":{"head_path":"/needhelp/needhelp-web/-/jobs/123456789/artifacts/download?file_type=codequality\u0026proxy=true","base_path":"/needhelp/needhelp-web/-/jobs/987654321/artifacts/download?file_type=codequality\u0026proxy=true"},"…
When I copy/paste the path in my url bar without the \u0026proxy=true, the file is successfully downloaded.
Here the .gitlab-ci.yml configuration which generate the file.
static analysis:
stage: test
interruptible: true
image:
name: $CI_QA_IMAGE
entrypoint: [""]
script:
- composer install --prefer-dist --no-progress --classmap-authoritative --quiet
- php bin/console --env=test cache:warmup
- |
./vendor/bin/phpstan analyze -c phpstan.neon --no-progress --memory-limit 1G --error-format=gitlab > code-quality.json && phpstan_error=0 || phpstan_error=1
if [[ -n $phpstan_error ]]; then
echo -e '\e[103;1mphpstan detected errors.\e[0m'
ls -lh code-quality.json
cat code-quality.json
./vendor/bin/phpstan analyze -c phpstan.ci.neon --no-progress --memory-limit 1G
else
echo -e '\e[92;1mphpstan detected no error with levelmax configuration.\e[0m'
fi
- bin/console lint:twig --env=test
- bin/console lint:container --env=test
- bin/console lint:xliff translations/ --env=test
artifacts:
when: always
reports:
codequality: ./code-quality.json
Do you know what is wrong with this code ? Or if it's ok, where should I look to fix this ?
One possible reason is gitlab failed to parse code-quality.json
You can use some tool to validate the json format, for example: http://json.parser.online.fr/

Bash completion for path in argument (with equals sign present)

I used to be able to type the following:
$> ./foo --arg=<TAB>
Where foo is any program I wrote, and it would give me a list of files in the current directory, just like tab-completion normally does. I didn't have to make any changes to /etc/bash_completion.
Recently, however, this has gone away for some unknown reason. Does anyone know how to re-enable this feature?
FWIW, this still does the correct thing (notice the lack of an equals sign):
$> ./foo --arg <TAB>
I removed all bash completion scripts and started adding them one by one to if any of them cause the problem.
In my case it turned out to be the npm completion script was the cause of this problem.
Not sure (yet) what the problem is, but this is the completion script which caused equal sign values not working as before:
###-begin-npm-completion-###
#
# npm command completion script
#
# Installation: npm completion >> ~/.bashrc (or ~/.zshrc)
# Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm
#
COMP_WORDBREAKS=${COMP_WORDBREAKS/=/}
COMP_WORDBREAKS=${COMP_WORDBREAKS/#/}
export COMP_WORDBREAKS
if type complete &>/dev/null; then
_npm_completion () {
local si="$IFS"
IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \
COMP_LINE="$COMP_LINE" \
COMP_POINT="$COMP_POINT" \
npm completion -- "${COMP_WORDS[#]}" \
2>/dev/null)) || return $?
IFS="$si"
}
complete -F _npm_completion npm
elif type compdef &>/dev/null; then
_npm_completion() {
si=$IFS
compadd -- $(COMP_CWORD=$((CURRENT-1)) \
COMP_LINE=$BUFFER \
COMP_POINT=0 \
npm completion -- "${words[#]}" \
2>/dev/null)
IFS=$si
}
compdef _npm_completion npm
elif type compctl &>/dev/null; then
_npm_completion () {
local cword line point words si
read -Ac words
read -cn cword
let cword-=1
read -l line
read -ln point
si="$IFS"
IFS=$'\n' reply=($(COMP_CWORD="$cword" \
COMP_LINE="$line" \
COMP_POINT="$point" \
npm completion -- "${words[#]}" \
2>/dev/null)) || return $?
IFS="$si"
}
compctl -K _npm_completion npm
fi
###-end-npm-completion-###
Not sure what environment you're in, but on a recent CentOS
complete -D -o default
enables filename completion after a token w/o whitespace as the default. To toggle it in the other direction:
complete -D -o nospace
However, it looks like older versions of the builtin don't have the -D option.
I resolved the same trouble with Ubuntu 12.04 by using https://github.com/ai/rake-completion.
You need to
download the file wget -O ~/scripts/rake https://raw.githubusercontent.com/ai/rake-completion/master/rake
add to your .bashrc: . ~/scripts/rake
or You can use one of other ways on that page.

Resources