Skip to content

Commit

Permalink
feat(server): Store information about disabled checkers to the database
Browse files Browse the repository at this point in the history
[FULL DESCRIPTION W.I.P.]
  • Loading branch information
whisperity committed Dec 7, 2023
1 parent 9a91946 commit 835ea00
Show file tree
Hide file tree
Showing 25 changed files with 1,131 additions and 289 deletions.
35 changes: 0 additions & 35 deletions alembic.ini
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,3 @@ script_location = web/server/codechecker_server/migrations/report

sqlalchemy.url = postgres://postgres@localhost:5432/default
#sqlalchemy.url = sqlite:////home/username/.codechecker/Default.sqlite

# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = WARN
handlers = console
qualname =

[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine

[logger_alembic]
level = INFO
handlers =
qualname = alembic

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
36 changes: 33 additions & 3 deletions codechecker_common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"""
Util module.
"""


import itertools
import json
from typing import TextIO
from math import ceil
from typing import Callable, TextIO

import portalocker

from codechecker_common.logger import get_logger
Expand Down Expand Up @@ -44,6 +44,36 @@ def chunks(iterator, n):
yield itertools.chain([first], rest_of_chunk)


def progress(g, count: int, n: int,
callback: Callable[[int, float], None]):
"""
Wraps a generator of a known total length and fires 'callback' after having
yielded every (T/N)th element. The 'callback' is given the index of the
element handled just before firing it, and the percentage of progress.
"""
# E.g., if count == 100 and n == 5, then becomes [100, 95, ..., 10, 5, 0].
try:
checkpoints = [count] + list(reversed(
[list(chk)[0]
for chk in chunks(
range(0, count + 1),
int(ceil(count / n))
)]))
if checkpoints[-1] == 0:
checkpoints.pop()
except ValueError:
# The range is too small to have (count / n) many slices.
checkpoints = [count]

i = 0
for e in g:
i = i + 1
yield e
if i == checkpoints[-1]:
callback(i, float(i) / count * 100)
checkpoints.pop()


def load_json(path: str, default=None, lock=False, display_warning=True):
"""
Load the contents of the given file as a JSON and return it's value,
Expand Down
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/js/codechecker-api-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codechecker-api",
"version": "6.54.0",
"version": "6.55.0",
"description": "Generated node.js compatible API stubs for CodeChecker server.",
"main": "lib",
"homepage": "https://github.com/Ericsson/codechecker",
Expand Down
Binary file modified web/api/py/codechecker_api/dist/codechecker_api.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.54.0'
api_version = '6.55.0'

setup(
name='codechecker_api',
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion web/api/py/codechecker_api_shared/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
with open('README.md', encoding='utf-8', errors="ignore") as f:
long_description = f.read()

api_version = '6.54.0'
api_version = '6.55.0'

setup(
name='codechecker_api_shared',
Expand Down
9 changes: 6 additions & 3 deletions web/api/report_server.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ struct RunHistoryData {
4: string user, // User name who analysed the run.
5: string time, // Date time when the run was analysed.
6: i64 id, // Id of the run history tag.
7: string checkCommand, // Check command. !!!DEPRECATED!!! This field will be empty so use the getCheckCommand API function to get the check command for a run.
// !!!DEPRECATED!!! This field will be empty so use the getCheckCommand() API function to get the check command for a run.
7: string checkCommand,
8: string codeCheckerVersion, // CodeChecker client version of the latest analysis.
9: AnalyzerStatisticsData analyzerStatistics, // Statistics for analyzers. Only number of failed and successfully analyzed
// files field will be set. To get full analyzer statistics please use the
Expand Down Expand Up @@ -468,7 +469,9 @@ union AnalysisInfoFilter {
}

struct AnalysisInfo {
1: string analyzerCommand,
1: string analyzerCommand,
// For each analyzer, the list of all checkers that executed in the analysis.
2: optional map<string, list<string>> enabledCheckers,
}

typedef string CommitHash
Expand Down Expand Up @@ -534,7 +537,7 @@ service codeCheckerDBAccess {

// Get check command for a run.
// PERMISSION: PRODUCT_VIEW
// !DEPRECATED Use getAnalysisInfo API to get the check commands.
// !DEPRECATED Use getAnalysisInfo() API to get the check commands.
string getCheckCommand(1: i64 runHistoryId,
2: i64 runId)
throws (1: codechecker_api_shared.RequestFailed requestError),
Expand Down
2 changes: 1 addition & 1 deletion web/codechecker_web/shared/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# The newest supported minor version (value) for each supported major version
# (key) in this particular build.
SUPPORTED_VERSIONS = {
6: 54
6: 55
}

# Used by the client to automatically identify the latest major and minor
Expand Down
Loading

0 comments on commit 835ea00

Please sign in to comment.