mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
* Removed global install of lint modules * Fixed Lint Issues Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added lint script forapplication javascript Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> updated lint command for chaincode javascript Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> updated lint script Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> remove installing dependencies Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added lint script to js projects Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added more lint scripts Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added more lint scripts Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added missing npm lint command Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added missing eslint npm module Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> Fix missing npm lint command Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added missing eslint npm module to auction-simple javascctipt app Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added eslint npm module Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added eslint dependency Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added eslint dependency Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> added eslint dependency Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> Single command for ts js lint Signed-off-by: sapthasurendran <saptha.surendran@ibm.com> Fix or condition in lint.sh Signed-off-by: sapthasurendran <saptha.surendran@ibm.com>
48 lines
1.4 KiB
Bash
Executable file
48 lines
1.4 KiB
Bash
Executable file
set -euo pipefail
|
|
|
|
function print() {
|
|
GREEN='\033[0;32m'
|
|
NC='\033[0m'
|
|
echo
|
|
echo -e "${GREEN}${1}${NC}"
|
|
}
|
|
|
|
dirs=("$(find . -name "*-go" -o -name "*-java" -o -name "*-javascript" -o -name "*-typescript")")
|
|
for dir in $dirs; do
|
|
if [[ -d $dir ]]; then
|
|
print "Linting $dir"
|
|
pushd $dir
|
|
if [[ "$dir" =~ "-go" ]]; then
|
|
go get golang.org/x/tools/cmd/goimports
|
|
print "Running go vet"
|
|
go vet ./...
|
|
print "Running gofmt"
|
|
output=$(gofmt -l -s $(go list -f '{{.Dir}}' ./...))
|
|
if [[ "${output}" != "" ]]; then
|
|
print "The following files contain formatting errors, please run 'gofmt -l -w <path>' to fix these issues:"
|
|
echo "${output}"
|
|
fi
|
|
|
|
print "Running goimports"
|
|
output=$(goimports -l $(go list -f '{{.Dir}}' ./...))
|
|
if [[ "${output}" != "" ]]; then
|
|
print "The following files contain import errors, please run 'goimports -l -w <path>' to fix these issues:"
|
|
echo "${output}"
|
|
fi
|
|
elif [[ "$dir" =~ "-javascript" || "$dir" =~ "-typescript" ]]; then
|
|
print "Installing node modules"
|
|
npm install
|
|
print "Running Lint"
|
|
npm run lint
|
|
elif [[ "$dir" =~ "-java" ]]; then
|
|
if [[ -f "pom.xml" ]]; then
|
|
print "Running Maven Build"
|
|
mvn clean package
|
|
else
|
|
print "Running Gradle Build"
|
|
./gradlew build
|
|
fi
|
|
fi
|
|
popd
|
|
fi
|
|
done
|