Skip to content

Commit 7a5db2b

Browse files
Pin the pre-commit hook hashes
Signed-off-by: pdmurray <peynmurray@gmail.com> Co-authored-by: Sarah Monod <smonod1@bloomberg.net>
1 parent debc9e8 commit 7a5db2b

30 files changed

Lines changed: 360 additions & 414 deletions

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.4.0
3+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
44
hooks:
55
- id: check-added-large-files
66
- id: check-json
@@ -12,41 +12,41 @@ repos:
1212
exclude: "^[.]bumpversion[.]cfg"
1313

1414
- repo: https://github.com/pre-commit/pygrep-hooks
15-
rev: v1.10.0
15+
rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0
1616
hooks:
1717
- id: rst-directive-colons
1818
- id: rst-inline-touching-normal
1919

2020
- repo: https://github.com/charliermarsh/ruff-pre-commit
21-
rev: "v0.0.262"
21+
rev: "5e2fb545eba1ea9dc051f6f962d52fe8f76a9794" # frozen: v0.15.13
2222
hooks:
2323
- id: ruff
2424
args: [--fix, --exit-non-zero-on-fix]
2525
stages: [pre-commit]
2626

2727
- repo: https://github.com/psf/black
28-
rev: 23.3.0
28+
rev: 87928e6d6761a4a6d22250e1fee5601b3998086e # frozen: 26.5.1
2929
hooks:
3030
- id: black
3131

3232
- repo: https://github.com/pycqa/isort
33-
rev: 5.12.0
33+
rev: dac090ce4d9ee313d086e2e89ab1acb8c2664fa1 # frozen: 9.0.0a3
3434
hooks:
3535
- id: isort
3636
exclude_types: [python]
3737

3838
- repo: https://github.com/sphinx-contrib/sphinx-lint
39-
rev: v0.6.7
39+
rev: c883505f64b59c3c5c9375191e4ad9f98e727ccd # frozen: v1.0.2
4040
hooks:
4141
- id: sphinx-lint
4242

4343
- repo: https://github.com/executablebooks/mdformat/
44-
rev: 0.7.16
44+
rev: 82912cdaea4fb830f751504486a7879c70526547 # frozen: 1.0.0
4545
hooks:
4646
- id: mdformat
4747

4848
- repo: https://github.com/pre-commit/mirrors-clang-format
49-
rev: v16.0.2
49+
rev: dd18dad857d6133e90bbe478f4f2f22ec0030269 # frozen: v22.1.5
5050
hooks:
5151
- id: clang-format
5252
args: [--Werror, -i]

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ issue, or any other method of communication with the maintainers of this reposit
55

66
You can also search this project for issues with the following labels:
77

8-
| Label | Search Term | Description |
8+
| Label | Search Term | Description |
99
| ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1010
| [good-first-issue](https://github.com/bloomberg/pystack/search?q=is%3Aissue+is%3Aopen+label%3Agood-first-issue&type=Issues&utf8=%E2%9C%93) | `is:issue is:open label:good-first-issue` | Recommended for first-time contributors! These are well-defined, and allow a user to get familiar with the project's workflow before tackling more complex issues. |
11-
| [help wanted](https://github.com/bloomberg/pystack/search?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+&type=Issues&utf8=%E2%9C%93) | `is:issue is:open label:"help wanted"` | General issues where contributors help is wanted. |
12-
| [question](https://github.com/bloomberg/pystack/search?q=is%3Aissue+is%3Aopen+label%3Aquestion&type=Issues&utf8=%E2%9C%93) | `is:issue is:open label:question` | Open discussions to resolve everything from implementation details to desired functionality. |
11+
| [help wanted](https://github.com/bloomberg/pystack/search?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+&type=Issues&utf8=%E2%9C%93) | `is:issue is:open label:"help wanted"` | General issues where contributors help is wanted. |
12+
| [question](https://github.com/bloomberg/pystack/search?q=is%3Aissue+is%3Aopen+label%3Aquestion&type=Issues&utf8=%E2%9C%93) | `is:issue is:open label:question` | Open discussions to resolve everything from implementation details to desired functionality. |
1313

1414
## Contribution Licensing
1515

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ CMAKE_BUILD_TYPE = "Release"
5555

5656
[tool.ruff]
5757
line-length = 95
58-
select = ["F", "E", "W", "I001"]
58+
lint.select = ["F", "E", "W", "I001"]
5959

60-
[tool.ruff.isort]
60+
[tool.ruff.lint.isort]
6161
force-single-line = true
6262
known-first-party = ["pystack"]
6363
known-third-party=["rich", "elftools", "pytest"]

src/pystack/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def _exit_with_code(exception: BaseException) -> NoReturn: # pragma: no cover
7272

7373
def produce_error_message(exception: BaseException) -> str:
7474
msg = (
75-
f"💀 {exception} 💀\n" if os.environ.get("NO_COLOR") is None else f"{exception}\n"
75+
f"💀 {exception} 💀\n"
76+
if os.environ.get("NO_COLOR") is None
77+
else f"{exception}\n"
7678
)
7779
if PERMISSION_ERROR_MSG in str(exception) or isinstance(exception, PermissionError):
7880
msg += PERMISSION_HELP_TEXT
@@ -304,15 +306,13 @@ def green(key: str) -> str:
304306

305307
state = as_green_str(chr(psinfo["sname"]))
306308
zombie = as_green_str(bool([psinfo["zomb"]]))
307-
return dedent(
308-
f"""
309+
return dedent(f"""
309310
{colored("Core file information:", "blue")}
310311
state: {state} zombie: {zombie} niceness: {green('nice')}
311312
pid: {green('pid')} ppid: {green('ppid')} sid: {green('sid')}
312313
uid: {green('uid')} gid: {green('gid')} pgrp: {green('pgrp')}
313314
executable: {green('fname')} arguments: {green('psargs')}
314-
"""
315-
)
315+
""")
316316

317317

318318
def format_failureinfo_information(failure_info: Dict[str, Any]) -> str:

src/pystack/_pystack/corefile.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ CoreFileExtractor::findExecFn() const
426426

427427
if (elf_getshdrnum(elf, &shnum) < 0) {
428428
LOG(ERROR) << "Cannot determine the number of sections in the ELF file";
429-
return (uintptr_t) nullptr;
429+
return (uintptr_t)nullptr;
430430
}
431431

432432
LOG(DEBUG) << "Found " << shnum << " sections in the ELF file";
@@ -460,7 +460,7 @@ CoreFileExtractor::findExecFn() const
460460
}
461461
}
462462
LOG(ERROR) << "Failed to extract the ExecFn information from the core file";
463-
return (uintptr_t) nullptr;
463+
return (uintptr_t)nullptr;
464464
}
465465
std::vector<std::string>
466466
CoreFileExtractor::missingModules() const

src/pystack/_pystack/corefile.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class CoreAnalyzerError : public std::exception
4343
{
4444
public:
4545
explicit CoreAnalyzerError(std::string error)
46-
: d_error(std::move(error)){};
46+
: d_error(std::move(error)) {};
4747

4848
[[nodiscard]] const char* what() const noexcept override
4949
{

src/pystack/_pystack/elf_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ElfAnalyzerError : public std::exception
2323
{
2424
public:
2525
explicit ElfAnalyzerError(std::string error)
26-
: d_error(std::move(error)){};
26+
: d_error(std::move(error)) {};
2727

2828
const char* what() const noexcept override
2929
{

src/pystack/_pystack/logging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LOG
2222
public:
2323
// Constructors
2424
LOG()
25-
: msgLevel(INFO){};
25+
: msgLevel(INFO) {};
2626

2727
explicit LOG(logLevel type)
2828
{

src/pystack/_pystack/mem.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ VirtualMap::Size() const
115115

116116
LRUCache::LRUCache(size_t capacity)
117117
: d_cache_capacity(capacity)
118-
, d_size(0){};
118+
, d_size(0) {};
119119

120120
void
121121
LRUCache::put(uintptr_t key, std::vector<char>&& value)
@@ -285,7 +285,7 @@ ProcessMemoryManager::copyMemoryFromProcess(remote_addr_t addr, size_t len, void
285285
bool
286286
ProcessMemoryManager::isAddressValid(remote_addr_t addr, const VirtualMap& map) const
287287
{
288-
if (addr == (uintptr_t) nullptr) {
288+
if (addr == (uintptr_t)nullptr) {
289289
return false;
290290
}
291291
return map.Start() <= addr && addr < map.End();
@@ -506,7 +506,7 @@ CorefileRemoteMemoryManager::getMemoryLocationFromElf(
506506
bool
507507
CorefileRemoteMemoryManager::isAddressValid(remote_addr_t addr, const VirtualMap& map) const
508508
{
509-
if (addr == (uintptr_t) nullptr) {
509+
if (addr == (uintptr_t)nullptr) {
510510
return false;
511511
}
512512
return map.Start() <= addr && addr < map.Start() + map.Size();

src/pystack/_pystack/process.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,11 +1425,11 @@ ProcessManager::ProcessManager(
14251425
std::optional<VirtualMap> bss,
14261426
std::optional<VirtualMap> heap)
14271427
: AbstractProcessManager(
1428-
pid,
1429-
std::move(memory_maps),
1430-
std::move(main_map),
1431-
std::move(bss),
1432-
std::move(heap))
1428+
pid,
1429+
std::move(memory_maps),
1430+
std::move(main_map),
1431+
std::move(bss),
1432+
std::move(heap))
14331433
, d_tracer(tracer)
14341434
{
14351435
if (d_tracer) {
@@ -1511,11 +1511,11 @@ CoreFileProcessManager::CoreFileProcessManager(
15111511
std::optional<VirtualMap> bss,
15121512
std::optional<VirtualMap> heap)
15131513
: AbstractProcessManager(
1514-
pid,
1515-
std::move(memory_maps),
1516-
std::move(main_map),
1517-
std::move(bss),
1518-
std::move(heap))
1514+
pid,
1515+
std::move(memory_maps),
1516+
std::move(main_map),
1517+
std::move(bss),
1518+
std::move(heap))
15191519
{
15201520
d_analyzer = analyzer;
15211521
d_manager = std::make_unique<CorefileRemoteMemoryManager>(analyzer, d_memory_maps);

0 commit comments

Comments
 (0)