diff --git a/.github/workflows/automated-checks.yml b/.github/workflows/automated-checks.yml index 191f9eed..7d228656 100644 --- a/.github/workflows/automated-checks.yml +++ b/.github/workflows/automated-checks.yml @@ -206,7 +206,7 @@ jobs: working-directory: artifacts - name: Upload Coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos files: artifacts/coverage-${{ github.event_name }}-${{ github.sha }}/coverage.xml # optional diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ddaee69..65213665 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning] ## \[In Development\] - Unreleased +## \[1.20.7\] - 2023-09-14 + +### Fixed + +- Exception: 'NoneType' object has no attribute 'character_name' when opening the + Dashboard view and in one of the displayed SRP links is a fleet commander who + doesn't exist anymore. + ## \[1.20.6\] - 2023-09-12 ### Fixed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f9a0b13..1a911a0d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,98 +5,194 @@ ______________________________________________________________________ - [Contributing](#contributing) - - [Code Formatting](#code-formatting) - - [Contributing via Pull Requests](#contributing-via-pull-requests) - - [Commits](#commits) - - [Test Coverage](#test-coverage) + - [Development Environment](#development-environment) + - [Code Formatting and Linting](#code-formatting-and-linting) + - [Python](#python) + - [JavaScript](#javascript) + - [Minified JS](#minified-js) + - [CSS](#css) + - [Minified CSS](#minified-css) + - [pre-commit](#pre-commit) + - [Branching and Contributing via Pull Requests](#branching-and-contributing-via-pull-requests) + - [Tests](#tests) + - [Checklist](#checklist) - [Translation](#translation) ______________________________________________________________________ -## Code Formatting +## Development Environment -This app is utilizing the [Black](https://black.readthedocs.io/en/stable/the_black_code_style.html) -code style. Every commit has to adhere to it. +To develop and test your change you will need a development environment on your +local machine. There are many different options to choose from. But please make sure +that you can run pre-commit checks and tox tests on your local machine. -This repository uses [pre-commit](https://github.com/pre-commit/pre-commit) to -verify compliance with formatting rules. To use: +If you are on Windows or Linux you can use the [AA guide for setting up a dev +environment][aa guide for setting up a dev environment]. -1. Install `pre-commit`. -1. From inside the `aa-srp` root directory, run `pre-commit install`. -1. You're all done! Code will be checked automatically using git hooks. +## Code Formatting and Linting -You can check if your code to commit adheres to the given style by simply running: +### Python + +This app is utilizing the [Black code style]. Every commit has to adhere to it. + +When making changes to the source code, please always reformat the changed files in +order to ensure consistent formatting across the code base. + +To reformat run the following from the app's root directory: ```shell -pre-commit +pre-commit run black ``` -Or to check all files: +### JavaScript + +The JavaScript code follows [ECMAScript 6 (or ES6 for short)][ecmascript 6] or later +rules. The use of arrow functions is preferred and `this` or `$(this)` should be +prevented. Functions need to be declared before their use and the JavaScript code +should follow `'use strict';`. + +Indent size: 4 spaces + +A linter configuration is declared as `.eslintrc.json` in the app's root directory. + +To check that your JavaScript code adheres to the rules, run: ```shell -pre-commit run --all-files +pre-commit run eslint ``` -The following will be checked by `pre-commit`: +#### Minified JS -- no trailing whitespaces (excluded are: minified js and css, .po and .mo files) -- one, and only one, empty line at the end of every file (excluded are: minified js and css, .po and .mo files) -- line ending is LF -- code formatted according to black code style -- code conforms with flake8 +This project uses minified and compressed JavaScript files with source maps created by +[UglifyJS]. Make sure to add/update them as well if you add or change JavaScript. -## Contributing via Pull Requests +To do so, run: -To contribute code via pull request, make sure that you fork the repository and branch -your changes from the `development` branch. Only pull requests towards the development -branch will be considered. +```shell +uglifyjs script.js -o script.min.js --source-map "url='script.min.js.map'" --compress --mangle +``` -Please make sure you have signed the [License Agreement](https://developers.eveonline.com/resource/license-agreement) -by logging in at https://developers.eveonline.com before submitting any pull requests. +### CSS -### Commits +The CSS should be written in a modern manner. Colour definitions should be in RGB(A) +(`rgb(255 255 255)`, `rgba(255 255 255 / 50%)`) for example. -Commit headers should be short (not longer than 70 characters) and precise. Use -the commit body for a more detailed explanation of the commit. +A linter configuration is declared as `.stylelintrc.json` in the app's root directory. -Commit headers should be prefixed to state what kind of commit it is. +Indent size: 4 spaces -- `[FEATURE] Foobar` When a new feature is introduced -- `[ADDED] Foobar` When something is added to the code base to enhance existing - functions -- `[REMOVED] Foobar` When something is removed, like deprecated or unused code -- `[FIX] Foobar` For bug fixes or fixes in general. Ideally followed by an issue ID -- `[CHANGE] Foobar` When Code or appearance has been changed that doesn't fit in any - of the other categories. Usually for changes in templates or optimisations in the - Python code itself -- `[MISC] Foobar` When it doesn't fit in anything else +To check that your JavaScript code adheres to the rules, run: -### Test Coverage +```shell +pre-commit run stylelint +``` -Please make sure your contribution comes with tests covering your additions and -changes. We aim to always improve the test coverage in this project. Pull -requests lowering the test coverage will not be considered for merging. +#### Minified CSS -You can run tests locally via: +This project uses minified CSS files with source maps created by [CSSO]. Make sure +to add/update them as well if you add or change CSS. ```shell -make coverage +csso -i styles.css -o styles.min.css -s file ``` -The full tox-test suite can be run via: +### pre-commit -```shell -make tox_tests +This repository uses [pre-commit] to verify compliance with formatting / linting rules. +To use: + +1. Install `pre-commit` to your system. +1. Run' pre-commit install' inside the app's root directory. +1. You're all done! Code will be checked automatically using git hooks. + +You can check if your code to commit adheres to the given style by simply running: + +```shell script +pre-commit ``` +Or to check all files: + +```shell script +pre-commit run --all-files +``` + +The following will be checked by `pre-commit` (among others): + +- No trailing whitespaces (excluded are minified js and css, .po and .mo files and + external libs) +- One, and only one, empty line at the end of every file (excluded are minified js + and css, .po and .mo files and external libs) +- Line ending is LF +- Python code formatted according to black code style +- Python code blocks in markdown files are formatted to black code style +- Code conforms with flake8 +- Code generally adheres to the editor config +- Python code is updated to the minimal Python version +- Python code is updated to the minimal Django version +- Imports in Python code are sorted properly +- Markdown files are formatted properly +- No pylint issues + +## Branching and Contributing via Pull Requests + +To contribute code via pull request, make sure that you fork the repository and +branch your changes from the `development` branch. We strongly recommend to create a +new branch for every new feature or change you plan to be submitting as merge request. + +Only pull requests towards the `development` branch will be considered. + +Before you start working on a new feature, please open an Issue (Type: Feature +Request) and start a discussion if your idea is generally wanted and considered a +good addition to the app in general. + +Please feel free to create your merge request early and while you are still not +finished developing to flag that you are working on a specific topic. Merge request +that are not yet ready to review should be marked as DRAFT. You can signal others +that your merge request is ready for review by removing the DRAFT flag again. + +## Tests + +Please update existing or provide additional unit tests for your changes. Note that +your merge request might fail if it reduces the current level of test coverage. + +We are using [Python unittest] with the Django `TestCase` class for all tests. In +addition we are using some following 3rd party test tools: + +- django-webtest / [WebTest] - testing the web UI +- [request-mock] - testing requests with the requests library +- [tox] - Running the test suite +- [coverage] - Measuring the test coverage + +## Checklist + +Before you submit a pull request, please make sure that: + +- [ ] Your code follows the style guidelines of this project +- [ ] Your changes are supported and covered by tests +- [ ] You have performed a self-review of your own code +- [ ] You have commented on your code, particularly in hard-to-understand areas +- [ ] You have checked your code and corrected any misspellings + ## Translation This app is fully translation-ready and translations are handled via [Weblate]. If you like to contribute to the app's translation or simply improve it, feel free to -register on my [Weblate] site and message me, so I can add you to the right group. +register on my [Weblate] instance and start translating. +[aa guide for setting up a dev environment]: https://allianceauth.readthedocs.io/en/latest/development/dev_setup/aa-dev-setup-wsl-vsc-v2.html "AA Guide for Setting up a Dev Environment" +[black code style]: https://black.readthedocs.io/en/latest/l "Black Code Style" +[coverage]: https://coverage.readthedocs.io/en/latest/ "coverage" +[csso]: https://github.com/css/csso "CSSO (CSS Optimizer)" +[ecmascript 6]: https://www.w3schools.com/js/js_es6.asp "JavaScript ECMAScript 6" +[pre-commit]: https://github.com/pre-commit/pre-commit "pre-commit" +[python unittest]: https://docs.python.org/3/library/unittest.html "Python Unittests" +[request-mock]: https://requests-mock.readthedocs.io/en/latest/ "request-mock" +[tox]: https://tox.wiki/en/latest/ "tox" +[uglifyjs]: https://github.com/mishoo/UglifyJS "UglifyJS" [weblate]: https://weblate.ppfeufer.de/ "Weblate" +[webtest]: https://docs.pylonsproject.org/projects/webtest/en/latest/ "Webtest" diff --git a/aasrp/views/ajax.py b/aasrp/views/ajax.py index af87ed74..35b8c489 100644 --- a/aasrp/views/ajax.py +++ b/aasrp/views/ajax.py @@ -141,7 +141,7 @@ def dashboard_srp_links_data( "creator": get_main_character_from_user(user=srp_link.creator), "fleet_time": srp_link.fleet_time, "fleet_type": fleet_type, - "fleet_commander": srp_link.fleet_commander.character_name, + # "fleet_commander": srp_link.fleet_commander.character_name, "fleet_doctrine": srp_link.fleet_doctrine, "aar_link": aar_link, "srp_code": {"display": srp_code_html, "sort": srp_link.srp_code}, diff --git a/pyproject.toml b/pyproject.toml index 9aaedc9e..edfd4584 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ [project] name = "aa-srp" -version = "1.20.6" +version = "1.20.7" description = "Improved SRP Module for Alliance Auth" readme = "README.md" keywords = [