Skip to content

Commit

Permalink
refactor(server/config): Implement a proper configuration manager
Browse files Browse the repository at this point in the history
This commit introduces a new `ServerConfiguration` handler object which
duty is to deal with everything about handling of the configuration
options the servers are started with.
Previously, this was done by the `SessionManager` class since
commit a5119f0
introduced non-authentication-related configuration options into the
previously authentication-only configuration file.

The new infrastructure aims to offer a generally more user-friendly
and more type-safe way of dealing with configuration options in
various parts of the `server` package.
`Option`s are registered simply, akin to adding command-line options
to an `argparse`-based parser.
  • Loading branch information
whisperity committed Aug 7, 2024
1 parent f85f771 commit c4e99a6
Show file tree
Hide file tree
Showing 31 changed files with 2,713 additions and 670 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ on: [push, pull_request]
permissions: read-all

jobs:
# Note: UI related linter tests will run in the gui job.
lint:
name: Linters (pylint, pycodestyle)

# Note: UI-related linters will run in the UI job(s).
name: Linters and Static Analysis
runs-on: ubuntu-20.04

steps:
Expand All @@ -19,9 +18,18 @@ jobs:
python-version: '3.8'
- name: Install dependencies
run: |
pip install $(grep -iE "pylint|pycodestyle" analyzer/requirements_py/dev/requirements.txt)
- name: Run tests
run: make pylint pycodestyle
pip install $(grep -iE \
"mypy|pycodestyle|pylint|types" \
analyzer/requirements_py/dev/requirements.txt) \
$(grep -iE \
"mypy|pycodestyle|pylint|types" \
codechecker_common/requirements_py/dev/requirements.txt)
- name: Run pylint & pycodestyle
run: make -k pycodestyle pylint

- name: Run codechecker_common mypy tests
working-directory: codechecker_common
run: make mypy

tools:
name: Tools (report-converter, etc.)
Expand Down Expand Up @@ -120,9 +128,8 @@ jobs:
run: |
pip install -r requirements_py/dev/requirements.txt
- name: Run mypy tests
working-directory: codechecker_common/tests
run: make mypy
- name: Run unit tests
run: make test_common

web:
name: Web
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.DS_Store

*.py[cod]
### Python ###
# Byte-compiled / optimized / DLL files.
__pycache__/
*.py[cdo]

build
build_dist
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,15 @@ pycodestyle:
pycodestyle_in_env:
$(ACTIVATE_DEV_VENV) && $(PYCODE_CMD)

test: test_analyzer test_web
test: test_common test_analyzer test_web

test_in_env: test_analyzer_in_env test_web_in_env
test_in_env: test_common_in_env test_analyzer_in_env test_web_in_env

test_common:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_COMMON) test

test_commin_in_env:
$(MAKE) -C $(CC_COMMON) test_in_env

test_analyzer:
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_ANALYZER) test
Expand Down
1 change: 1 addition & 0 deletions codechecker_common/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include tests/Makefile
7 changes: 3 additions & 4 deletions codechecker_common/compatibility/multiprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# pylint: disable=no-name-in-module
# pylint: disable=unused-import
if sys.platform in ["darwin", "win32"]:
from multiprocess import Pool # type: ignore
from multiprocess import cpu_count
from multiprocess import Pool, Process, cpu_count
else:
from concurrent.futures import ProcessPoolExecutor as Pool # type: ignore
from multiprocessing import cpu_count
from concurrent.futures import ProcessPoolExecutor as Pool
from multiprocessing import Process, cpu_count
Loading

0 comments on commit c4e99a6

Please sign in to comment.