Commit 363027fd authored by Úrsula Iguarán's avatar Úrsula Iguarán 💬

Add Pre-Commit check

parent 8f6f3a3d

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File mode changed from 100644 to 100755
......@@ -25,10 +25,10 @@ checks:
- docker:dind
script:
- if curl --fail -Lo artifacts.zip --header Private-Token:$DOCKER_PASSWD https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/jobs/artifacts/$CI_COMMIT_REF_NAME/download?job=$CI_JOB_NAME; then unzip artifacts.zip && rm artifacts.zip; else echo "There are no artifacts"; fi
- pre-commit run --all-files
- ./check-changed.sh
- ./check-all.sh
- ./check-articles.sh
- ./sass-lint.sh
- pybabel compile --directory theme/2014/translations/ --domain messages
- for FILE in $(find . -iname '*.adoc'); do sed -i 's/^include::/include::\/builds\/fluidsignal/g' $FILE; done
- sed -i 's/https:\/\/fluidattacks\.com/http:\/\/'"$CI_COMMIT_REF_SLUG.$CI_PROJECT_NAME.$ENV_DNS"'/g' pelicanconf.py
......
exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.2.3
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- repo: https://github.com/pre-commit/mirrors-scss-lint
rev: v0.57.0
hooks:
- id: scss-lint
......@@ -8,5 +8,5 @@ for FILE in $(find output -iname '*.html'); do
aws s3api put-object --acl public-read \
--bucket $S3_BUCKET_NAME --key $NAME --content-type text/html \
--website-redirect-location "/$NAME/";
fi;
done
\ No newline at end of file
fi;
done
......@@ -4,16 +4,15 @@ WORKDIR /app
COPY . /app
# 22-24: Install basic dependencies to set sources lists
# 22-24: Install basic dependencies to set sources lists
# 25-27: Set sources for NodeJS and Yarn
# 28-52: Install all necessarty dependencies
# 53-54: Download tidy-html binary and install it
# 55-56: Download Java Runtime Environment needed to generate PlantUML diagrams
# 57-60: Clone the necessaty JS files from the Tipue repository in order to run the plugin
# 61-64: Clone just the plugins that are being used in this project with Pelican
# 61-64: Clone just the plugins that are being used in this project with Pelican
# 65-66: Clone the pelican-redirect plugin (aside from the official repository) and make it recognizable as a module
# 67: Change the default highlighter to Pygments
# 68: Enable every rule of sass-lint
# 69-70: Download and install the PlantUML filter for Asciidoc
# 71-76: Add a variable to the Asciidoc Reader with the source path and reference it in the filters
# 77: Set Charset in the execution of plantuml.jar
......@@ -26,7 +25,7 @@ RUN apt-get update -qq && apt-get install -qqy \
gnupg2 \
software-properties-common && \
curl -sL https://deb.nodesource.com/setup_9.x | bash - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - && \
add-apt-repository \
......@@ -57,8 +56,8 @@ RUN apt-get update -qq && apt-get install -qqy \
setuptools \
wheel && \
pip install -r requirements.txt && \
gem install -N sass && \
yarn install && \
gem install -N sass && \
curl -sSLo tidy.deb https://github.com/htacg/tidy-html5/releases/download/5.4.0/tidy-5.4.0-64bit.deb && \
dpkg -i tidy.deb && \
curl -sSLo java.tar.gz http://javadl.oracle.com/webapps/download/AutoDL?BundleId=230532_2f38c3b165be4555a1fa6e98c45e0808 && \
......@@ -73,8 +72,7 @@ RUN apt-get update -qq && apt-get install -qqy \
git pull origin master && git reset --hard 3924d5b && \
git clone --depth=1 https://github.com/slinkp/pelican-redirect.git && cd pelican-redirect && git reset --hard f00004c && \
echo "from .pelican_redirect import *" > __init__.py && \
sed -i 's/source-highlight$/pygments/' /etc/asciidoc/asciidoc.conf && \
sed -i 's/0/1/' /app/node_modules/sass-lint/lib/config/sass-lint.yml && cd /app && \
sed -i 's/source-highlight$/pygments/' /etc/asciidoc/asciidoc.conf && cd /app && \
curl -sSLo plantuml.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/asciidoc-plantuml/plantuml.zip && \
asciidoc --filter install plantuml.zip /etc/asciidoc/filters/ && \
sed -i 's/\+\ options/\+\ options\ \+\ \['\''-a\ path=%s'\''\ %\ adoc_path\]/; \
......@@ -97,9 +95,9 @@ RUN apt-get update -qq && apt-get install -qqy \
plugin_list.txt \
requirements.txt \
tidy.deb \
yarn.lock
yarn.lock
# Add the uglifyjs program to the PATH
ENV PATH=$PATH:/app/node_modules/uglify-js/bin/:/app/node_modules/sass-lint/bin/:/app/jre1.8.0_161/bin/
ENV PATH=$PATH:/app/node_modules/uglify-js/bin/:/app/jre1.8.0_161/bin/
CMD ["bash"]
File mode changed from 100644 to 100755
......@@ -5,7 +5,6 @@
"jquery": "^3.3.1",
"owl.carousel2": "^2.2.1",
"popper.js": "^1.12.9",
"sass-lint": "^1.12.1",
"uglify-js": "^3.3.8"
}
}
File mode changed from 100644 to 100755
asn1crypto==0.23.0
aspy.yaml==1.0.0
awscli==1.14.22
Babel==2.5.1
bcrypt==3.1.4
beautifulsoup4==4.6.0
blinker==1.4
botocore==1.8.26
cached-property==1.4.0
certifi==2017.11.5
cffi==1.11.2
cfgv==1.0.0
chardet==3.0.4
Cheetah==2.4.4
colorama==0.3.7
......@@ -22,6 +25,7 @@ futures==3.2.0
ghp-import==0.4.1
html5lib==0.9999999
httplib2==0.10.3
identify==1.0.8
idna==2.6
ipaddress==1.0.18
Jinja2==2.10
......@@ -31,12 +35,14 @@ jsonpointer==1.14
lazr.uri==1.0.3
Markdown==2.6.9
MarkupSafe==1.0
nodeenv==1.3.0
oauth==1.0.1
olefile==0.44
paramiko==2.4.0
pelican==3.7.1
pelican-gist==0.3.3
Pillow==4.3.0
pre-commit==1.8.2
prettytable==0.7.2
pyasn1==0.3.7
pycparser==2.18
......@@ -59,6 +65,7 @@ smartypants==2.0.0
typogrify==2.0.7
Unidecode==1.0.22
urllib3==1.22
virtualenv==15.2.0
wadllib==1.3.2
webassets==0.12.1
zope.interface==4.4.3
This diff is collapsed.
......@@ -5,11 +5,11 @@ ataques
certificaciones
cobol
csharp
filosofía
filosofía
glassfish
hacking
html
identidad
identidad
java
javascript
linux
......
File mode changed from 100644 to 100755
......@@ -4,7 +4,7 @@ NC='\033[0m'
ERRORS=0
# Check use of incorrect names to address the company
if pcregrep --color -nr --include='\.adoc' -e 'Fluid|Fluidsignal\ Group|fluidsignal|\ fluid[)}\ \]]' content; then
if pcregrep --color -nr --include='\.adoc' -e 'Fluid|Fluidsignal\ Group|fluidsignal|\ fluid[)}\ \]]' content; then
echo -e "${GC}\nThe only accepted name is FLUID.${NC}"
ERRORS=1;
fi
......@@ -202,7 +202,7 @@ for FILE in $(find content -iname '*.adoc'); do
if pcregrep --color -Mnq '^\[source' $FILE; then
if ! pcregrep --color -Mnq '^\..*\n\[source' $FILE; then
echo -e "${GC}The first code block of an article must have a title.${NC}";
ERRORS=1;
ERRORS=1;
fi
fi
done
......
......@@ -6,8 +6,8 @@ ERRORS=0
#For spanish blog / defends
for FILE in $(find content/blog-es content/defends -iname '*.adoc'); do
# Check that every article in blog and defends has a valid category
# Check that every article in blog and defends has a valid category
ARTCAT=$(cat $FILE | pcregrep --color -o '(?<=^:category:).*');
if ! cat categorias.lst | pcregrep -q $ARTCAT ; then
echo -e "${RD} $ARTCAT";
......@@ -16,22 +16,22 @@ for FILE in $(find content/blog-es content/defends -iname '*.adoc'); do
fi
# Check that every article in blog has valid tags
if ! pcregrep -q ':defends:' $FILE ; then
if ! pcregrep -q ':defends:' $FILE ; then
ARTTAGS=$(cat $FILE | pcregrep -o '(?<=^:tags:).*'| tr , \\n)
for TAG in $( echo $ARTTAGS ); do
if ! cat etiquetas.lst | pcregrep -q $TAG ; then
echo -e "${RD} $TAG";
echo -e "${GC} The previous tag is not valid. Please correct the file \"$FILE\" or add the new tag in the list. ${NC}";
ERRORS=1;
ERRORS=1;
fi
done
fi
fi
done
#For english blog
for FILE in $(find content/blog-en -iname '*.adoc'); do
# Check that every article in blog has a valid category
# Check that every article in blog has a valid category
ARTCAT=$(cat $FILE | pcregrep --color -o '(?<=^:category:).*');
if ! cat categories.lst | pcregrep -q $ARTCAT ; then
echo -e "${RD} $ARTCAT";
......@@ -45,10 +45,10 @@ for FILE in $(find content/blog-en -iname '*.adoc'); do
if ! cat tags.lst | pcregrep -q $TAG ; then
echo -e "${RD} $TAG";
echo -e "${GC} The previous tag is not valid. Please correct the file \"$FILE\" or add the new tag in the list. ${NC}";
ERRORS=1;
ERRORS=1;
fi
done
done
exit $ERRORS
\ No newline at end of file
exit $ERRORS
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755