Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pylint.yml #22

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
952e103
Create pylint.yml
ZanderCowboy Oct 10, 2023
9f2e25a
Update pylint.yml
ZanderCowboy Oct 10, 2023
c01868a
Added very_good_analysis to pubspec.yaml
ZanderCowboy Oct 10, 2023
35d612f
Added very_good_analysis to pubspec.yaml
ZanderCowboy Oct 10, 2023
27b55b8
Added SonarLint to .iml files.
ZanderCowboy Oct 10, 2023
eb7f079
Fixed linting issues.
ZanderCowboy Oct 10, 2023
cfa55fb
Fixed linting issues.
ZanderCowboy Oct 10, 2023
8131c36
Fixed linting issues.
ZanderCowboy Oct 10, 2023
fd2e42e
Renamed files to snake_case
ZanderCowboy Oct 11, 2023
a484b50
Fixed linting issues.
ZanderCowboy Oct 11, 2023
2c21a8d
Fixed linting issues.
ZanderCowboy Oct 11, 2023
fa704c7
Removed python 3.8 from pylint
ZanderCowboy Oct 11, 2023
384174d
Fixed linting issues.
ZanderCowboy Oct 11, 2023
6bce59b
Fixed linting issues.
ZanderCowboy Oct 11, 2023
e121a31
Fixed linting issues.
ZanderCowboy Oct 11, 2023
8affe96
Cleaned up some code.
ZanderCowboy Oct 11, 2023
18fb37d
Merge branch 'main' into ZanderCowboy-patch-1
ZanderCowboy Oct 15, 2023
4961295
Fixed merge conflicts.
ZanderCowboy Oct 15, 2023
1e81970
Cleaned up merge from 'main' branch
ZanderCowboy Oct 15, 2023
a2c14f2
Removed files from merge conflicts
ZanderCowboy Oct 15, 2023
1ece7b6
Fixed linting issues.
ZanderCowboy Oct 15, 2023
c9ac79c
Fixed linting issues.
ZanderCowboy Oct 15, 2023
2f54d6a
Moved files to docs folder.
ZanderCowboy Oct 15, 2023
91ebf6c
Added new jobs to workflows.
ZanderCowboy Oct 15, 2023
0da75e6
Fixed issue for 'cd' with linter.yml
ZanderCowboy Oct 15, 2023
8dc259b
Fixed linting issues for workflows
ZanderCowboy Oct 15, 2023
6e826d7
Fixed linting issues and tried something with dataclasses.
ZanderCowboy Oct 16, 2023
fe7a2f4
Fixed requirements.txt issue with linter.yml
ZanderCowboy Oct 16, 2023
cbf04ae
Fixed linting issues.
ZanderCowboy Oct 16, 2023
f48feaf
Created requirements.txt and added dependencies.
ZanderCowboy Oct 16, 2023
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
131 changes: 131 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
name: Lint Code Base

on:
push:
branches:
[main, master]
pull_request:
branches:
[main, master]
workflow_dispatch:

jobs:
flutter:
name: Flutter Build
runs-on: ubuntu-latest
env:
FLUTTER_VERSION: "3.13.5"
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Flutter Actions
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.13.5
cache: true

- run: |
cd frontend
flutter --version
flutter pub get
flutter analyze


python:
name: Python Lint
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: 3.11
cache: 'pip'

- name: Install dependencies
run: |
cd engine
python --version
python -m pip install --upgrade pip
pip install flake8 pylint pytest

- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')

- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics


java:
name: Java Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
# cache: 'maven'

# - name: Build with Maven
# run: mvn -B package --file pom.xml

- run: |
cd backend/src
javac Main.java
# ./mvnw clean install # Assuming you have a Maven wrapper script (mvnw) in your repository
# Additional steps for testing and other build tasks as needed




# run-lint:
# name: Run Lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0

# - name: Setup Flutter SDK
# uses: flutter-actions/setup-flutter@v2
# with:
# channel: stable
# version: 3.13.5
# cache: true

# - uses: subosito/flutter-action@v2
# with:
# channel: stable
# flutter-version: 3.13.5
# # cache: true

# - run: flutter --version

# - name: Install dependencies
# run: flutter pub get

# - name: Lint Code Base
# uses: github/super-linter@v4
# env:
# VALIDATE_ALL_CODEBASE: false
# DEFAULT_BRANCH: main
# GITHUB_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
# # SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
25 changes: 25 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Pylint

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# python-version: ["3.9", "3.10", "3.11"]
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Default Reviewer

* @skulos
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License
# MIT License

Copyright (c) 2022 Hendre Hayman and Zander Kotze
Copyright (c) 2023 Zander Kotze and Hendre Hayman

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
# verbose-adventure

This is 3 Way Propositional Logic Truth Table Generator that takes an input statement and returns a processed truth table.

Add a list of things that is used for the module such as intellij, python, etc.
[![GitHub Super-Linter](https://github.com/ZanderCowboy/verbose-adventure/actions/workflows/linter.yml/badge.svg)](https://github.com/marketplace/actions/super-linter)

[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)

## Dependencies

## Recommended IDE Setup
- IntelliJ

- IntelliJ
- VS Code
- Android Studio (This is optional which can be used with the UI)

## Project Setup

### Engine

The engine uses Python 3.11 in a virtual environment

### Backend
The backend uses Java JDK 17 and greater.

The backend uses Java JDK 17 or greater.

### Frontend
The frontend uses Flutter and Dart SDK.

The frontend uses the latest version of Flutter and Dart SDK.
Android Studio?

### Importing into IntelliJ
Instruction to import the project into IntelliJ

Instruction to import the project into IntelliJ

## Technology Stack

- Flutter
- Python
- Java
- GRPC
- GRPC
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
A Java HTTP server with a gRPC client to talk to the Python Backend on behalf of the Flutter Frontend

## JDK version

- 17
- 20
-
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
4 changes: 2 additions & 2 deletions engine/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project Debugging
/Output/*.log
/Output/*.log.*
/output/*.log
/output/*.log.*

# intellij
/.idea
Expand Down
29 changes: 20 additions & 9 deletions engine/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Changes in code

## V0.0.7
- Created a new Logging package to contain all logging related code.
## v0.0.8

- Ran pylint and fixed all linting issues.
- Fixed imports.
- Added GitHub actions for Engine.

## v0.0.7

- Created a new Logging package to contain all logging related code.
- Created logging_config using Python logging, printing logs to console and files
- Created log folder and files as Output/engine.log, Output/engine.log.1, etc.
- Created a rotator for log files, so that a log history can be kept.
- Added logging throughout the code.
- Finished some documentation.
- Refactored code, removing redundant parts.
- Finished some documentation.
- Refactored code, removing redundant parts.
- Added more TODOs for later development.
- Created a new generalized printing function in PrintDetails.py used to do
'sections of output' logging
- Created a new generalized printing function in PrintDetails.py used to do 'sections of output' logging

## v0.0.6

- Created a constants file containing all the constants that is used in the code
- Created a new file CreateElements.py, moving the array creation to it and out
of CreateConditionals.py
Expand All @@ -29,19 +36,23 @@
- Deleted DumpFile.py and LogicCalculator.py

## v0.0.5

- created packages: Components, Computation, GRPCServer, Parser, Simulator, Validation
- refactored exiting code and moved it around
- IN PROGRESS: added metadata to existing code
- tested a try-catch block with Parser.Checks
- created Simulator.SimulateServer.py to simulate the input and responses generated
- created Simulator.SimulateServer.py to simulate the input and responses generated
from using the GRPCServer
- Moved existing code into single files, following the SOLID principle

## v0.0.2 - v0.0.4
- Added small changes over time.

- Added small changes over time.

## v0.0.1

- needs restructuring

## v0.0.0
- initial code copied from other project

- initial code copied from other project
29 changes: 29 additions & 0 deletions engine/Components/create_elements.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""_summary_

Returns:
_type_: _description_
"""
from engine_logging.logging_config import logger


def create_array_of_elements(statement: str) -> list:
"""
This takes a statement as a string and returns an array of elements
For example:
"(P^Q)" => ['(', 'P', '^', 'Q', ')']

:rtype: list
:param statement: string
:return: Returns an array of elements
"""

logger.debug("Creating an array from a string...")
logger.debug("Calling create_array_of_elements(%s)", statement)

array_of_elements = []
for _, char in enumerate(statement):
array_of_elements.append(char)

logger.debug("array_of_elements=%s", array_of_elements)
logger.debug("Finished creating array.")
return array_of_elements
Loading
Loading