Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ jobs:

build:
runs-on: ubuntu-latest
container: nastyabirillo/hyperstyle
# Consistent with Version.md
container: nastyabirillo/hyperstyle:1.1.0

steps:

Expand Down
20 changes: 8 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# This Dockerfile is used only for production
FROM python:3.8-buster

FROM python:3.8.2-alpine3.11
RUN apt-get update && \
apt-get install -y openjdk-11-jdk && \
apt-get install -y nodejs npm

RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \
&& apk add --update nodejs npm

RUN npm i -g eslint@7.5.0
RUN npm i npm@latest -g

RUN java -version
RUN ls /usr/lib/jvm

# Other dependencies
RUN apk add bash

# Set up Eslint
RUN npm install eslint --save-dev && ./node_modules/.bin/eslint --init

# Dependencies and package installation
WORKDIR /

Expand All @@ -28,6 +21,9 @@ RUN pip3 install --no-cache-dir -r review/requirements.txt
COPY . review
RUN pip3 install --no-cache-dir ./review

# Set up Eslint
RUN npm install --prefix ./review eslint@7.5.0 --save-dev && ./review/node_modules/.bin/eslint --init

# Container's enviroment variables
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk
ENV PATH="$JAVA_HOME/bin:${PATH}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ __Note__: If you have `ModuleNotFoundError` while you try to run tests, please c
__Note__: We use [eslint](https://eslint.org/) and [open-jdk 11](https://openjdk.java.net/projects/jdk/11/)
in the tests. Please, set up the environment before running the tests.
You can see en example of the environment configuration in
the [Dockerfile](./docker/dev/Dockerfile) file.
the [Dockerfile](Dockerfile) file.

Use `pytest` from the root directory to run __ALL__ tests.

37 changes: 0 additions & 37 deletions docker/dev/Dockerfile

This file was deleted.

3 changes: 2 additions & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ jsonschema~=3.2.0
django~=3.2
pylint~=2.7.4
requests~=2.25.1
setuptools~=56.0.0
setuptools~=56.0.0
pandas
14 changes: 13 additions & 1 deletion src/python/review/inspectors/eslint/eslint.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pathlib import Path
from typing import List

Expand All @@ -20,9 +21,20 @@ class ESLintInspector(BaseInspector):
r'complexity of (\d+)'
}

@classmethod
def _get_eslint_local_path(cls) -> str:
common_path = 'node_modules/.bin/eslint'
standard_path = f'./{common_path}'
prod_path = f'./review/{common_path}'
if os.path.exists(standard_path):
return standard_path
elif os.path.exists(prod_path):
return prod_path
raise FileNotFoundError('Eslint was not configured!')

@classmethod
def _create_command(cls, path: Path, output_path: Path, is_local: bool = False) -> List[str]:
eslint_command = 'eslint' if not is_local else './node_modules/.bin/eslint'
eslint_command = 'eslint' if not is_local else cls._get_eslint_local_path()
return [
eslint_command,
'-c', PATH_ESLINT_CONFIG,
Expand Down