Skip to content

Python scraper based on AI

evaluation score

VinciGit000dc6f69104ab
diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml
index 3f2a360a..5dce37d5 100644
--- a/.github/workflows/pylint.yml
+++ b/.github/workflows/pylint.yml
@@ -21,4 +21,5 @@ jobs:
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
- pylint --disable=C0114,C0115,C0116 --exit-zero scrapegraphai/**/*.py scrapegraphai/*.py examples/*.py tests/*.py
+ pylint --disable=C0114,C0115,C0116 --exit-zero scrapegraphai/**/*.py scrapegraphai/*.py examples/*.py tests/*.py > pylint_output.txt
+ python evaluate_pylint_score.py pylint_output.txt
diff --git a/utils/evaluate_pylint_score.py b/utils/evaluate_pylint_score.py
new file mode 100644
index 00000000..1d3dc0d0
--- /dev/null
+++ b/utils/evaluate_pylint_score.py
@@ -0,0 +1,27 @@
+# evaluate_pylint_score.py
+
+import sys
+
+def evaluate_pylint_score(output_file):
+ with open(output_file, 'r') as f:
+ lines = f.readlines()
+
+ score_line = next((line for line in lines if 'Your code has been rated at' in line), None)
+ if score_line:
+ score = float(score_line.split(' ')[-2])
+ if score >= 6:
+ print("Pylint score is acceptable. Proceeding with the push.")
+ sys.exit(0)
+ else:
+ print("Pylint score is below 6. Skipping the push.")
+ sys.exit(1)
+ else:
+ print("Pylint score not found in output. Skipping the push.")
+ sys.exit(1)
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ print("Usage: python evaluate_pylint_score.py <pylint_output_file>")
+ sys.exit(1)
+ output_file = sys.argv[1]
+ evaluate_pylint_score(output_file)