id
int64 | file_name
string | file_path
string | content
string | size
int64 | language
string | extension
string | total_lines
int64 | avg_line_length
float64 | max_line_length
int64 | alphanum_fraction
float64 | repo_name
string | repo_stars
int64 | repo_forks
int64 | repo_open_issues
int64 | repo_license
string | repo_extraction_date
string | exact_duplicates_stackv2
bool | exact_duplicates_redpajama
bool | exact_duplicates_stackv1
bool | near_duplicates_stackv2
bool | near_duplicates_stackv1
bool | near_duplicates_redpajama
bool | near_duplicates_codeparrot
bool | near_duplicates_githubcode
bool | exact_duplicates_githubcode
bool | exact_duplicates_codeparrot
bool | bandit
string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0
|
core_test.py
|
git-cola_git-cola/test/core_test.py
|
"""Tests the cola.core module's unicode handling"""
from cola import core
from . import helper
def test_core_decode():
"""Test the core.decode function"""
filename = helper.fixture('unicode.txt')
expect = core.decode(core.encode('unicøde'))
actual = core.read(filename).strip()
assert expect == actual
def test_core_encode():
"""Test the core.encode function"""
filename = helper.fixture('unicode.txt')
expect = core.encode('unicøde')
actual = core.encode(core.read(filename).strip())
assert expect == actual
def test_decode_None():
"""Ensure that decode(None) returns None"""
expect = None
actual = core.decode(None)
assert expect == actual
def test_decode_utf8():
filename = helper.fixture('cyrillic-utf-8.txt')
actual = core.read(filename)
assert actual.encoding == 'utf-8'
def test_decode_non_utf8():
filename = helper.fixture('cyrillic-cp1251.txt')
actual = core.read(filename)
assert actual.encoding == 'iso-8859-15'
def test_decode_non_utf8_string():
filename = helper.fixture('cyrillic-cp1251.txt')
with open(filename, 'rb') as f:
content = f.read()
actual = core.decode(content)
assert actual.encoding == 'iso-8859-15'
def test_guess_mimetype():
value = '字龍.txt'
expect = 'text/plain'
actual = core.guess_mimetype(value)
assert expect == actual
# This function is robust to bytes vs. unicode
actual = core.guess_mimetype(core.encode(value))
assert expect == actual
| 1,528
|
Python
|
.py
| 42
| 31.714286
| 53
| 0.689891
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:52Z",
"metrics": {
"/tmp/tmpml053r6z.py": {
"CONFIDENCE.HIGH": 8,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 8,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 41,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 8,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 8,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 41,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "12 actual = core.read(filename).strip()\n13 assert expect == actual\n14 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 13,
"line_range": [
13
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "20 actual = core.encode(core.read(filename).strip())\n21 assert expect == actual\n22 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 21,
"line_range": [
21
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "27 actual = core.decode(None)\n28 assert expect == actual\n29 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 28,
"line_range": [
28
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "33 actual = core.read(filename)\n34 assert actual.encoding == 'utf-8'\n35 \n",
"col_offset": 4,
"end_col_offset": 37,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 34,
"line_range": [
34
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "39 actual = core.read(filename)\n40 assert actual.encoding == 'iso-8859-15'\n41 \n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 40,
"line_range": [
40
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "47 actual = core.decode(content)\n48 assert actual.encoding == 'iso-8859-15'\n49 \n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 48,
"line_range": [
48
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "54 actual = core.guess_mimetype(value)\n55 assert expect == actual\n56 # This function is robust to bytes vs. unicode\n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 55,
"line_range": [
55
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "57 actual = core.guess_mimetype(core.encode(value))\n58 assert expect == actual\n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpml053r6z.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 58,
"line_range": [
58
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
1
|
startup_test.py
|
git-cola_git-cola/test/startup_test.py
|
"""Test Startup Dialog (git cola --prompt) Context Menu and related classes"""
from cola.widgets import startup
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def test_get_with_default_repo(app_context):
"""Test BuildItem::get for default repo"""
path = '/home/foo/git-cola'
name = 'git-cola'
mode = startup.ICON_MODE
is_bookmark = True
app_context.cfg.set_repo('cola.defaultrepo', path)
builder = startup.BuildItem(app_context)
actual = builder.get(path, name, mode, is_bookmark)
assert actual.path == path
assert actual.name == name
assert actual.mode == startup.ICON_MODE
assert actual.is_default
assert actual.is_bookmark
assert actual.text() == name
assert actual.isEditable()
def test_get_with_non_default_repo(app_context):
"""Test BuildItem::get for non-default repo"""
default_repo_path = '/home/foo/default_repo'
path = '/home/foo/git-cola'
name = 'git-cola'
mode = startup.ICON_MODE
is_bookmark = True
app_context.cfg.set_repo('cola.defaultrepo', default_repo_path)
builder = startup.BuildItem(app_context)
actual = builder.get(path, name, mode, is_bookmark)
assert actual.path == path
assert actual.name == name
assert not actual.is_default
assert actual.is_bookmark == is_bookmark
assert actual.text() == name
assert actual.isEditable()
def test_get_with_item_from_recent(app_context):
"""Test BuildItem::get for repository from recent list"""
path = '/home/foo/git-cola'
name = 'git-cola'
mode = startup.ICON_MODE
is_bookmark = False
app_context.cfg.set_repo('cola.defaultrepo', path)
builder = startup.BuildItem(app_context)
actual = builder.get(path, name, mode, is_bookmark)
assert actual.path == path
assert actual.name == name
assert actual.is_default
assert not actual.is_bookmark
assert actual.text() == name
assert actual.isEditable()
def test_get_with_list_mode(app_context):
"""Test BuildItem::get for list mode building"""
path = '/home/foo/git-cola'
name = 'git-cola'
mode = startup.LIST_MODE
is_bookmark = True
app_context.cfg.set_repo('cola.defaultrepo', path)
builder = startup.BuildItem(app_context)
actual = builder.get(path, name, mode, is_bookmark)
assert actual.path == path
assert actual.name == name
assert actual.is_default
assert actual.is_bookmark
assert actual.text() == path
assert not actual.isEditable()
| 2,555
|
Python
|
.py
| 67
| 33.343284
| 78
| 0.703163
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| false
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:53Z",
"metrics": {
"/tmp/tmp1b9iprkl.py": {
"CONFIDENCE.HIGH": 26,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 26,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 66,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 26,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 26,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 66,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "6 # Prevent unused imports lint errors.\n7 assert app_context is not None\n8 \n",
"col_offset": 0,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 7,
"line_range": [
7
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "21 \n22 assert actual.path == path\n23 assert actual.name == name\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 22,
"line_range": [
22
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "22 assert actual.path == path\n23 assert actual.name == name\n24 assert actual.mode == startup.ICON_MODE\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 23,
"line_range": [
23
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "23 assert actual.name == name\n24 assert actual.mode == startup.ICON_MODE\n25 assert actual.is_default\n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 24,
"line_range": [
24
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "24 assert actual.mode == startup.ICON_MODE\n25 assert actual.is_default\n26 assert actual.is_bookmark\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 25,
"line_range": [
25
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "25 assert actual.is_default\n26 assert actual.is_bookmark\n27 assert actual.text() == name\n",
"col_offset": 4,
"end_col_offset": 29,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 26,
"line_range": [
26
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "26 assert actual.is_bookmark\n27 assert actual.text() == name\n28 assert actual.isEditable()\n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 27,
"line_range": [
27
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "27 assert actual.text() == name\n28 assert actual.isEditable()\n29 \n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 28,
"line_range": [
28
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "43 \n44 assert actual.path == path\n45 assert actual.name == name\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 44,
"line_range": [
44
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "44 assert actual.path == path\n45 assert actual.name == name\n46 assert not actual.is_default\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 45,
"line_range": [
45
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "45 assert actual.name == name\n46 assert not actual.is_default\n47 assert actual.is_bookmark == is_bookmark\n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 46,
"line_range": [
46
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "46 assert not actual.is_default\n47 assert actual.is_bookmark == is_bookmark\n48 assert actual.text() == name\n",
"col_offset": 4,
"end_col_offset": 44,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 47,
"line_range": [
47
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "47 assert actual.is_bookmark == is_bookmark\n48 assert actual.text() == name\n49 assert actual.isEditable()\n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 48,
"line_range": [
48
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "48 assert actual.text() == name\n49 assert actual.isEditable()\n50 \n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 49,
"line_range": [
49
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "63 \n64 assert actual.path == path\n65 assert actual.name == name\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 64,
"line_range": [
64
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "64 assert actual.path == path\n65 assert actual.name == name\n66 assert actual.is_default\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 65,
"line_range": [
65
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "65 assert actual.name == name\n66 assert actual.is_default\n67 assert not actual.is_bookmark\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 66,
"line_range": [
66
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "66 assert actual.is_default\n67 assert not actual.is_bookmark\n68 assert actual.text() == name\n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 67,
"line_range": [
67
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "67 assert not actual.is_bookmark\n68 assert actual.text() == name\n69 assert actual.isEditable()\n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 68,
"line_range": [
68
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "68 assert actual.text() == name\n69 assert actual.isEditable()\n70 \n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 69,
"line_range": [
69
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "83 \n84 assert actual.path == path\n85 assert actual.name == name\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 84,
"line_range": [
84
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "84 assert actual.path == path\n85 assert actual.name == name\n86 assert actual.is_default\n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 85,
"line_range": [
85
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "85 assert actual.name == name\n86 assert actual.is_default\n87 assert actual.is_bookmark\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 86,
"line_range": [
86
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "86 assert actual.is_default\n87 assert actual.is_bookmark\n88 assert actual.text() == path\n",
"col_offset": 4,
"end_col_offset": 29,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 87,
"line_range": [
87
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "87 assert actual.is_bookmark\n88 assert actual.text() == path\n89 assert not actual.isEditable()\n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 88,
"line_range": [
88
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "88 assert actual.text() == path\n89 assert not actual.isEditable()\n",
"col_offset": 4,
"end_col_offset": 34,
"filename": "/tmp/tmp1b9iprkl.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 89,
"line_range": [
89
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
2
|
spellcheck_test.py
|
git-cola_git-cola/test/spellcheck_test.py
|
from cola import compat
from cola import spellcheck
from . import helper
def test_spellcheck_generator():
check = spellcheck.NorvigSpellCheck()
assert_spellcheck(check)
def test_spellcheck_unicode():
path = helper.fixture('unicode.txt')
check = spellcheck.NorvigSpellCheck(words=path)
assert_spellcheck(check)
def assert_spellcheck(check):
for word in check.read():
assert word is not None
assert isinstance(word, compat.ustr)
| 474
|
Python
|
.py
| 14
| 29.5
| 51
| 0.752759
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:53Z",
"metrics": {
"/tmp/tmpm47a5hdn.py": {
"CONFIDENCE.HIGH": 2,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 2,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 14,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 2,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 2,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 14,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "19 for word in check.read():\n20 assert word is not None\n21 assert isinstance(word, compat.ustr)\n",
"col_offset": 8,
"end_col_offset": 31,
"filename": "/tmp/tmpm47a5hdn.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 20,
"line_range": [
20
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "20 assert word is not None\n21 assert isinstance(word, compat.ustr)\n",
"col_offset": 8,
"end_col_offset": 44,
"filename": "/tmp/tmpm47a5hdn.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 21,
"line_range": [
21
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
3
|
compat_test.py
|
git-cola_git-cola/test/compat_test.py
|
"""Tests the compat module"""
import os
from cola import compat
def test_setenv():
"""Test the core.decode function"""
key = 'COLA_UNICODE_TEST'
value = '字龍'
compat.setenv(key, value)
assert key in os.environ
assert os.getenv(key)
compat.unsetenv(key)
assert key not in os.environ
assert not os.getenv(key)
| 351
|
Python
|
.py
| 13
| 22.615385
| 39
| 0.690909
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:54Z",
"metrics": {
"/tmp/tmpzbnsua4e.py": {
"CONFIDENCE.HIGH": 4,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 4,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 13,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 4,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 4,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 13,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "11 compat.setenv(key, value)\n12 assert key in os.environ\n13 assert os.getenv(key)\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpzbnsua4e.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 12,
"line_range": [
12
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "12 assert key in os.environ\n13 assert os.getenv(key)\n14 \n",
"col_offset": 4,
"end_col_offset": 25,
"filename": "/tmp/tmpzbnsua4e.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 13,
"line_range": [
13
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "15 compat.unsetenv(key)\n16 assert key not in os.environ\n17 assert not os.getenv(key)\n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmpzbnsua4e.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 16,
"line_range": [
16
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "16 assert key not in os.environ\n17 assert not os.getenv(key)\n",
"col_offset": 4,
"end_col_offset": 29,
"filename": "/tmp/tmpzbnsua4e.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 17,
"line_range": [
17
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
4
|
gitcfg_test.py
|
git-cola_git-cola/test/gitcfg_test.py
|
"""Test the cola.gitcfg module."""
import pathlib
from . import helper
from .helper import app_context
# Prevent unused imports lint errors.
assert app_context is not None
def assert_color(context, expect, git_value, key='test', default=None):
"""Helper function for testing color values"""
helper.run_git('config', 'cola.color.%s' % key, git_value)
context.cfg.reset()
actual = context.cfg.color(key, default)
assert expect == actual
def test_string(app_context):
"""Test string values in get()."""
helper.run_git('config', 'test.value', 'test')
assert app_context.cfg.get('test.value') == 'test'
def test_int(app_context):
"""Test int values in get()."""
helper.run_git('config', 'test.int', '42')
expect = 42
actual = app_context.cfg.get('test.int')
assert expect == actual
def test_true(app_context):
"""Test bool values in get()."""
helper.run_git('config', 'test.bool', 'true')
assert app_context.cfg.get('test.bool') is True
def test_false(app_context):
helper.run_git('config', 'test.bool', 'false')
assert app_context.cfg.get('test.bool') is False
def test_yes(app_context):
helper.run_git('config', 'test.bool', 'yes')
assert app_context.cfg.get('test.bool') is True
def test_no(app_context):
helper.run_git('config', 'test.bool', 'no')
assert app_context.cfg.get('test.bool') is False
def test_bool_no_value(app_context):
helper.append_file('.git/config', '[test]\n')
helper.append_file('.git/config', '\tbool\n')
assert app_context.cfg.get('test.bool') is True
def test_empty_value(app_context):
helper.append_file('.git/config', '[test]\n')
helper.append_file('.git/config', '\tvalue = \n')
assert app_context.cfg.get('test.value') == ''
def test_default(app_context):
"""Test default values in get()."""
assert app_context.cfg.get('does.not.exist') is None
assert app_context.cfg.get('does.not.exist', default=42) == 42
def test_get_all(app_context):
"""Test getting multiple values in get_all()"""
helper.run_git('config', '--add', 'test.value', 'abc')
helper.run_git('config', '--add', 'test.value', 'def')
expect = ['abc', 'def']
assert expect == app_context.cfg.get_all('test.value')
def test_color_rrggbb(app_context):
assert_color(app_context, (0xAA, 0xBB, 0xCC), 'aabbcc')
assert_color(app_context, (0xAA, 0xBB, 0xCC), '#aabbcc')
def test_color_int(app_context):
assert_color(app_context, (0x10, 0x20, 0x30), '102030')
assert_color(app_context, (0x10, 0x20, 0x30), '#102030')
def test_guitool_opts(app_context):
helper.run_git('config', 'guitool.hello world.cmd', 'hello world')
opts = app_context.cfg.get_guitool_opts('hello world')
expect = 'hello world'
actual = opts['cmd']
assert expect == actual
def test_guitool_names(app_context):
helper.run_git('config', 'guitool.hello meow.cmd', 'hello meow')
names = app_context.cfg.get_guitool_names()
assert 'hello meow' in names
def test_guitool_names_mixed_case(app_context):
helper.run_git('config', 'guitool.Meow Cat.cmd', 'cat hello')
names = app_context.cfg.get_guitool_names()
assert 'Meow Cat' in names
def test_find_mixed_case(app_context):
helper.run_git('config', 'guitool.Meow Cat.cmd', 'cat hello')
opts = app_context.cfg.find('guitool.Meow Cat.*')
assert opts['guitool.Meow Cat.cmd'] == 'cat hello'
def test_guitool_opts_mixed_case(app_context):
helper.run_git('config', 'guitool.Meow Cat.cmd', 'cat hello')
opts = app_context.cfg.get_guitool_opts('Meow Cat')
assert opts['cmd'] == 'cat hello'
def test_hooks(app_context):
helper.run_git('config', 'core.hooksPath', '/test/hooks')
expect = '/test/hooks'
actual = app_context.cfg.hooks()
assert expect == actual
def test_hooks_lowercase(app_context):
helper.run_git('config', 'core.hookspath', '/test/hooks-lowercase')
expect = '/test/hooks-lowercase'
actual = app_context.cfg.hooks()
assert expect == actual
def test_hooks_path(app_context):
helper.run_git('config', 'core.hooksPath', str(pathlib.Path('/test/hooks')))
expect = str(pathlib.Path('/test/hooks/example'))
actual = app_context.cfg.hooks_path('example')
assert expect == actual
def test_hooks_path_lowercase(app_context):
helper.run_git(
'config', 'core.hookspath', str(pathlib.Path('/test/hooks-lowercase'))
)
expect = str(pathlib.Path('/test/hooks-lowercase/example'))
actual = app_context.cfg.hooks_path('example')
assert expect == actual
| 4,587
|
Python
|
.py
| 103
| 40.126214
| 80
| 0.680189
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:54Z",
"metrics": {
"/tmp/tmpf3os3czt.py": {
"CONFIDENCE.HIGH": 22,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 22,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 102,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 22,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 22,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 102,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "8 # Prevent unused imports lint errors.\n9 assert app_context is not None\n10 \n",
"col_offset": 0,
"end_col_offset": 30,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 9,
"line_range": [
9
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "16 actual = context.cfg.color(key, default)\n17 assert expect == actual\n18 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 17,
"line_range": [
17
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "22 helper.run_git('config', 'test.value', 'test')\n23 assert app_context.cfg.get('test.value') == 'test'\n24 \n",
"col_offset": 4,
"end_col_offset": 54,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 23,
"line_range": [
23
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "30 actual = app_context.cfg.get('test.int')\n31 assert expect == actual\n32 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 31,
"line_range": [
31
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "36 helper.run_git('config', 'test.bool', 'true')\n37 assert app_context.cfg.get('test.bool') is True\n38 \n",
"col_offset": 4,
"end_col_offset": 51,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 37,
"line_range": [
37
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "41 helper.run_git('config', 'test.bool', 'false')\n42 assert app_context.cfg.get('test.bool') is False\n43 \n",
"col_offset": 4,
"end_col_offset": 52,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 42,
"line_range": [
42
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "46 helper.run_git('config', 'test.bool', 'yes')\n47 assert app_context.cfg.get('test.bool') is True\n48 \n",
"col_offset": 4,
"end_col_offset": 51,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 47,
"line_range": [
47
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "51 helper.run_git('config', 'test.bool', 'no')\n52 assert app_context.cfg.get('test.bool') is False\n53 \n",
"col_offset": 4,
"end_col_offset": 52,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 52,
"line_range": [
52
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "57 helper.append_file('.git/config', '\\tbool\\n')\n58 assert app_context.cfg.get('test.bool') is True\n59 \n",
"col_offset": 4,
"end_col_offset": 51,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 58,
"line_range": [
58
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "63 helper.append_file('.git/config', '\\tvalue = \\n')\n64 assert app_context.cfg.get('test.value') == ''\n65 \n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 64,
"line_range": [
64
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "68 \"\"\"Test default values in get().\"\"\"\n69 assert app_context.cfg.get('does.not.exist') is None\n70 assert app_context.cfg.get('does.not.exist', default=42) == 42\n",
"col_offset": 4,
"end_col_offset": 56,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 69,
"line_range": [
69
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "69 assert app_context.cfg.get('does.not.exist') is None\n70 assert app_context.cfg.get('does.not.exist', default=42) == 42\n71 \n",
"col_offset": 4,
"end_col_offset": 66,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 70,
"line_range": [
70
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "77 expect = ['abc', 'def']\n78 assert expect == app_context.cfg.get_all('test.value')\n79 \n",
"col_offset": 4,
"end_col_offset": 58,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 78,
"line_range": [
78
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "95 actual = opts['cmd']\n96 assert expect == actual\n97 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 96,
"line_range": [
96
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "101 names = app_context.cfg.get_guitool_names()\n102 assert 'hello meow' in names\n103 \n",
"col_offset": 4,
"end_col_offset": 32,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 102,
"line_range": [
102
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "107 names = app_context.cfg.get_guitool_names()\n108 assert 'Meow Cat' in names\n109 \n",
"col_offset": 4,
"end_col_offset": 30,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 108,
"line_range": [
108
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "113 opts = app_context.cfg.find('guitool.Meow Cat.*')\n114 assert opts['guitool.Meow Cat.cmd'] == 'cat hello'\n115 \n",
"col_offset": 4,
"end_col_offset": 54,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 114,
"line_range": [
114
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "119 opts = app_context.cfg.get_guitool_opts('Meow Cat')\n120 assert opts['cmd'] == 'cat hello'\n121 \n",
"col_offset": 4,
"end_col_offset": 37,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 120,
"line_range": [
120
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "126 actual = app_context.cfg.hooks()\n127 assert expect == actual\n128 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 127,
"line_range": [
127
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "133 actual = app_context.cfg.hooks()\n134 assert expect == actual\n135 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 134,
"line_range": [
134
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "140 actual = app_context.cfg.hooks_path('example')\n141 assert expect == actual\n142 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 141,
"line_range": [
141
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "149 actual = app_context.cfg.hooks_path('example')\n150 assert expect == actual\n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpf3os3czt.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 150,
"line_range": [
150
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
5
|
main_model_test.py
|
git-cola_git-cola/test/main_model_test.py
|
import os
import pytest
from cola import core
from cola import git
from cola.models import main
from cola.models.main import FETCH, FETCH_HEAD, PULL, PUSH
from . import helper
from .helper import app_context
from .helper import Mock
# prevent unused imports lint errors.
assert app_context is not None
REMOTE = 'server'
LOCAL_BRANCH = 'local'
REMOTE_BRANCH = 'remote'
@pytest.fixture
def mock_context():
"""Return a Mock context for testing"""
context = Mock()
context.git = git.create()
return context
def test_project(app_context):
"""Test the 'project' attribute."""
project = os.path.basename(core.getcwd())
app_context.model.set_worktree(core.getcwd())
assert app_context.model.project == project
def test_local_branches(app_context):
"""Test the 'local_branches' attribute."""
helper.commit_files()
app_context.model.update_status()
assert app_context.model.local_branches == ['main']
def test_remote_branches(app_context):
"""Test the 'remote_branches' attribute."""
app_context.model.update_status()
assert app_context.model.remote_branches == []
helper.commit_files()
helper.run_git('remote', 'add', 'origin', '.')
helper.run_git('fetch', 'origin')
app_context.model.update_status()
assert app_context.model.remote_branches == ['origin/main']
def test_modified(app_context):
"""Test the 'modified' attribute."""
helper.write_file('A', 'change')
app_context.model.update_status()
assert app_context.model.modified == ['A']
def test_unstaged(app_context):
"""Test the 'unstaged' attribute."""
helper.write_file('A', 'change')
helper.write_file('C', 'C')
app_context.model.update_status()
assert app_context.model.unstaged == ['A', 'C']
def test_untracked(app_context):
"""Test the 'untracked' attribute."""
helper.write_file('C', 'C')
app_context.model.update_status()
assert app_context.model.untracked == ['C']
def test_stageable(app_context):
"""Test the 'stageable' attribute."""
assert not app_context.model.is_stageable()
def test_remotes(app_context):
"""Test the 'remote' attribute."""
helper.run_git('remote', 'add', 'origin', '.')
app_context.model.update_status()
assert app_context.model.remotes == ['origin']
def test_currentbranch(app_context):
"""Test the 'currentbranch' attribute."""
helper.run_git('checkout', '-b', 'test')
app_context.model.update_status()
assert app_context.model.currentbranch == 'test'
def test_tags(app_context):
"""Test the 'tags' attribute."""
helper.commit_files()
helper.run_git('tag', 'test')
app_context.model.update_status()
assert app_context.model.tags == ['test']
def test_remote_args_fetch(mock_context):
"""FETCH swaps arguments vs. PUSH and PULL"""
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
FETCH,
local_branch=LOCAL_BRANCH,
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'remote:local']
assert kwargs['verbose']
assert 'tags' not in kwargs
assert 'rebase' not in kwargs
def test_remote_args_fetch_head(mock_context):
"""Fetch handles the implicit FETCH_HEAD ref"""
# When FETCH_HEAD is used then we should not specify a tracking branch target.
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
FETCH,
local_branch=FETCH_HEAD,
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'remote']
def test_remote_args_fetch_tags(mock_context):
# Fetch tags
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
FETCH,
tags=True,
local_branch=LOCAL_BRANCH,
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'remote:local']
assert kwargs['verbose']
assert kwargs['tags']
assert 'rebase' not in kwargs
def test_remote_args_fetch_into_tracking_branch(mock_context):
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
FETCH,
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'remote:refs/remotes/server/remote']
def test_remote_args_pull(mock_context):
# Pull
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
PULL,
local_branch='',
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'remote']
assert kwargs['verbose']
assert 'rebase' not in kwargs
assert 'tags' not in kwargs
def test_remote_args_pull_rebase(mock_context):
# Rebasing pull
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
PULL,
rebase=True,
local_branch='',
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'remote']
assert kwargs['verbose']
assert kwargs['rebase']
assert 'tags' not in kwargs
def test_remote_args_push(mock_context):
"""PUSH swaps local and remote branches"""
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
PUSH,
local_branch=LOCAL_BRANCH,
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'local:remote']
assert kwargs['verbose']
assert 'tags' not in kwargs
assert 'rebase' not in kwargs
def test_remote_args_push_tags(mock_context):
"""Pushing tags uses --tags"""
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
PUSH,
tags=True,
local_branch=LOCAL_BRANCH,
remote_branch=REMOTE_BRANCH,
)
assert args == [REMOTE, 'local:remote']
assert kwargs['verbose']
assert kwargs['tags']
assert 'rebase' not in kwargs
def test_remote_args_push_same_remote_and_local(mock_context):
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
PUSH,
tags=True,
local_branch=LOCAL_BRANCH,
remote_branch=LOCAL_BRANCH,
)
assert args == [REMOTE, 'local']
assert kwargs['verbose']
assert kwargs['tags']
assert 'rebase' not in kwargs
def test_remote_args_push_set_upstream(mock_context):
(args, kwargs) = main.remote_args(
mock_context,
REMOTE,
PUSH,
tags=True,
local_branch=LOCAL_BRANCH,
remote_branch=LOCAL_BRANCH,
set_upstream=True,
)
assert args == [REMOTE, 'local']
assert kwargs['verbose']
assert kwargs['tags']
assert kwargs['set_upstream']
assert 'rebase' not in kwargs
def test_remote_args_rebase_only(mock_context):
(_, kwargs) = main.remote_args(
mock_context, REMOTE, PULL, rebase=True, ff_only=True
)
assert kwargs['rebase']
assert 'ff_only' not in kwargs
def test_run_remote_action(mock_context):
"""Test running a remote action"""
(args, kwargs) = main.run_remote_action(
mock_context,
lambda *args, **kwargs: (args, kwargs),
REMOTE,
FETCH,
local_branch=LOCAL_BRANCH,
remote_branch=REMOTE_BRANCH,
)
assert args == (REMOTE, 'remote:local')
assert kwargs['verbose']
assert 'tags' not in kwargs
assert 'rebase' not in kwargs
| 7,183
|
Python
|
.py
| 222
| 26.689189
| 82
| 0.655522
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:54Z",
"metrics": {
"/tmp/tmpr3fdk162.py": {
"CONFIDENCE.HIGH": 53,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 53,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 217,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 53,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 53,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 217,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "15 # prevent unused imports lint errors.\n16 assert app_context is not None\n17 \n",
"col_offset": 0,
"end_col_offset": 30,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 16,
"line_range": [
16
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "34 app_context.model.set_worktree(core.getcwd())\n35 assert app_context.model.project == project\n36 \n",
"col_offset": 4,
"end_col_offset": 47,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 35,
"line_range": [
35
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "41 app_context.model.update_status()\n42 assert app_context.model.local_branches == ['main']\n43 \n",
"col_offset": 4,
"end_col_offset": 55,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 42,
"line_range": [
42
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "47 app_context.model.update_status()\n48 assert app_context.model.remote_branches == []\n49 helper.commit_files()\n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 48,
"line_range": [
48
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "52 app_context.model.update_status()\n53 assert app_context.model.remote_branches == ['origin/main']\n54 \n",
"col_offset": 4,
"end_col_offset": 63,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 53,
"line_range": [
53
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "59 app_context.model.update_status()\n60 assert app_context.model.modified == ['A']\n61 \n",
"col_offset": 4,
"end_col_offset": 46,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 60,
"line_range": [
60
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "67 app_context.model.update_status()\n68 assert app_context.model.unstaged == ['A', 'C']\n69 \n",
"col_offset": 4,
"end_col_offset": 51,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 68,
"line_range": [
68
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "74 app_context.model.update_status()\n75 assert app_context.model.untracked == ['C']\n76 \n",
"col_offset": 4,
"end_col_offset": 47,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 75,
"line_range": [
75
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "79 \"\"\"Test the 'stageable' attribute.\"\"\"\n80 assert not app_context.model.is_stageable()\n81 \n",
"col_offset": 4,
"end_col_offset": 47,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 80,
"line_range": [
80
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "86 app_context.model.update_status()\n87 assert app_context.model.remotes == ['origin']\n88 \n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 87,
"line_range": [
87
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "93 app_context.model.update_status()\n94 assert app_context.model.currentbranch == 'test'\n95 \n",
"col_offset": 4,
"end_col_offset": 52,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 94,
"line_range": [
94
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "101 app_context.model.update_status()\n102 assert app_context.model.tags == ['test']\n103 \n",
"col_offset": 4,
"end_col_offset": 45,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 102,
"line_range": [
102
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "113 )\n114 assert args == [REMOTE, 'remote:local']\n115 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 114,
"line_range": [
114
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "114 assert args == [REMOTE, 'remote:local']\n115 assert kwargs['verbose']\n116 assert 'tags' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 115,
"line_range": [
115
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "115 assert kwargs['verbose']\n116 assert 'tags' not in kwargs\n117 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 31,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 116,
"line_range": [
116
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "116 assert 'tags' not in kwargs\n117 assert 'rebase' not in kwargs\n118 \n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 117,
"line_range": [
117
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "129 )\n130 assert args == [REMOTE, 'remote']\n131 \n",
"col_offset": 4,
"end_col_offset": 37,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 130,
"line_range": [
130
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "142 )\n143 assert args == [REMOTE, 'remote:local']\n144 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 143,
"line_range": [
143
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "143 assert args == [REMOTE, 'remote:local']\n144 assert kwargs['verbose']\n145 assert kwargs['tags']\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 144,
"line_range": [
144
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "144 assert kwargs['verbose']\n145 assert kwargs['tags']\n146 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 25,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 145,
"line_range": [
145
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "145 assert kwargs['tags']\n146 assert 'rebase' not in kwargs\n147 \n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 146,
"line_range": [
146
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "155 )\n156 assert args == [REMOTE, 'remote:refs/remotes/server/remote']\n157 \n",
"col_offset": 4,
"end_col_offset": 64,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 156,
"line_range": [
156
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "167 )\n168 assert args == [REMOTE, 'remote']\n169 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 37,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 168,
"line_range": [
168
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "168 assert args == [REMOTE, 'remote']\n169 assert kwargs['verbose']\n170 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 169,
"line_range": [
169
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "169 assert kwargs['verbose']\n170 assert 'rebase' not in kwargs\n171 assert 'tags' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 170,
"line_range": [
170
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "170 assert 'rebase' not in kwargs\n171 assert 'tags' not in kwargs\n172 \n",
"col_offset": 4,
"end_col_offset": 31,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 171,
"line_range": [
171
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "183 )\n184 assert args == [REMOTE, 'remote']\n185 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 37,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 184,
"line_range": [
184
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "184 assert args == [REMOTE, 'remote']\n185 assert kwargs['verbose']\n186 assert kwargs['rebase']\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 185,
"line_range": [
185
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "185 assert kwargs['verbose']\n186 assert kwargs['rebase']\n187 assert 'tags' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 186,
"line_range": [
186
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "186 assert kwargs['rebase']\n187 assert 'tags' not in kwargs\n188 \n",
"col_offset": 4,
"end_col_offset": 31,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 187,
"line_range": [
187
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "198 )\n199 assert args == [REMOTE, 'local:remote']\n200 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 199,
"line_range": [
199
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "199 assert args == [REMOTE, 'local:remote']\n200 assert kwargs['verbose']\n201 assert 'tags' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 200,
"line_range": [
200
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "200 assert kwargs['verbose']\n201 assert 'tags' not in kwargs\n202 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 31,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 201,
"line_range": [
201
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "201 assert 'tags' not in kwargs\n202 assert 'rebase' not in kwargs\n203 \n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 202,
"line_range": [
202
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "214 )\n215 assert args == [REMOTE, 'local:remote']\n216 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 215,
"line_range": [
215
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "215 assert args == [REMOTE, 'local:remote']\n216 assert kwargs['verbose']\n217 assert kwargs['tags']\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 216,
"line_range": [
216
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "216 assert kwargs['verbose']\n217 assert kwargs['tags']\n218 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 25,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 217,
"line_range": [
217
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "217 assert kwargs['tags']\n218 assert 'rebase' not in kwargs\n219 \n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 218,
"line_range": [
218
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "229 )\n230 assert args == [REMOTE, 'local']\n231 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 36,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 230,
"line_range": [
230
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "230 assert args == [REMOTE, 'local']\n231 assert kwargs['verbose']\n232 assert kwargs['tags']\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 231,
"line_range": [
231
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "231 assert kwargs['verbose']\n232 assert kwargs['tags']\n233 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 25,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 232,
"line_range": [
232
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "232 assert kwargs['tags']\n233 assert 'rebase' not in kwargs\n234 \n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 233,
"line_range": [
233
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "245 )\n246 assert args == [REMOTE, 'local']\n247 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 36,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 246,
"line_range": [
246
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "246 assert args == [REMOTE, 'local']\n247 assert kwargs['verbose']\n248 assert kwargs['tags']\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 247,
"line_range": [
247
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "247 assert kwargs['verbose']\n248 assert kwargs['tags']\n249 assert kwargs['set_upstream']\n",
"col_offset": 4,
"end_col_offset": 25,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 248,
"line_range": [
248
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "248 assert kwargs['tags']\n249 assert kwargs['set_upstream']\n250 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 249,
"line_range": [
249
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "249 assert kwargs['set_upstream']\n250 assert 'rebase' not in kwargs\n251 \n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 250,
"line_range": [
250
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "256 )\n257 assert kwargs['rebase']\n258 assert 'ff_only' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 257,
"line_range": [
257
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "257 assert kwargs['rebase']\n258 assert 'ff_only' not in kwargs\n259 \n",
"col_offset": 4,
"end_col_offset": 34,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 258,
"line_range": [
258
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "270 )\n271 assert args == (REMOTE, 'remote:local')\n272 assert kwargs['verbose']\n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 271,
"line_range": [
271
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "271 assert args == (REMOTE, 'remote:local')\n272 assert kwargs['verbose']\n273 assert 'tags' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 272,
"line_range": [
272
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "272 assert kwargs['verbose']\n273 assert 'tags' not in kwargs\n274 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 31,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 273,
"line_range": [
273
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "273 assert 'tags' not in kwargs\n274 assert 'rebase' not in kwargs\n",
"col_offset": 4,
"end_col_offset": 33,
"filename": "/tmp/tmpr3fdk162.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 274,
"line_range": [
274
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
6
|
app_test.py
|
git-cola_git-cola/test/app_test.py
|
import argparse
from cola import app
def test_setup_environment():
# If the function doesn't throw an exception we are happy.
assert hasattr(app, 'setup_environment')
app.setup_environment()
def test_add_common_arguments():
# If the function doesn't throw an exception we are happy.
parser = argparse.ArgumentParser()
assert hasattr(app, 'add_common_arguments')
app.add_common_arguments(parser)
| 428
|
Python
|
.py
| 11
| 34.909091
| 62
| 0.75
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:55Z",
"metrics": {
"/tmp/tmpunaax2jv.py": {
"CONFIDENCE.HIGH": 2,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 2,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 9,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 2,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 2,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 9,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "7 # If the function doesn't throw an exception we are happy.\n8 assert hasattr(app, 'setup_environment')\n9 app.setup_environment()\n",
"col_offset": 4,
"end_col_offset": 44,
"filename": "/tmp/tmpunaax2jv.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 8,
"line_range": [
8
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "14 parser = argparse.ArgumentParser()\n15 assert hasattr(app, 'add_common_arguments')\n16 app.add_common_arguments(parser)\n",
"col_offset": 4,
"end_col_offset": 47,
"filename": "/tmp/tmpunaax2jv.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 15,
"line_range": [
15
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
7
|
cmds_test.py
|
git-cola_git-cola/test/cmds_test.py
|
"""Test the cmds module"""
from cola import cmds
from cola.compat import uchr
from .helper import Mock, patch
def test_Commit_strip_comments():
"""Ensure that commit messages are stripped of comments"""
msg = 'subject\n\n#comment\nbody'
expect = 'subject\n\nbody\n'
actual = cmds.Commit.strip_comments(msg)
assert expect == actual
def test_commit_strip_comments_unicode():
"""Ensure that unicode is preserved in stripped commit messages"""
msg = uchr(0x1234) + '\n\n#comment\nbody'
expect = uchr(0x1234) + '\n\nbody\n'
actual = cmds.Commit.strip_comments(msg)
assert expect == actual
def test_unix_path_win32():
path = r'Z:\Program Files\git-cola\bin\git-dag'
expect = '/Z/Program Files/git-cola/bin/git-dag'
actual = cmds.unix_path(path, is_win32=lambda: True)
assert expect == actual
def test_unix_path_network_win32():
path = r'\\Z\Program Files\git-cola\bin\git-dag'
expect = '//Z/Program Files/git-cola/bin/git-dag'
actual = cmds.unix_path(path, is_win32=lambda: True)
assert expect == actual
def test_unix_path_is_a_noop_on_sane_platforms():
path = r'/:we/don\t/need/no/stinking/badgers!'
expect = path
actual = cmds.unix_path(path, is_win32=lambda: False)
assert expect == actual
def test_context_edit_command():
context = Mock()
model = context.model
cmd = cmds.EditModel(context)
cmd.new_diff_text = 'test_diff_text'
cmd.new_diff_type = 'test_diff_type'
cmd.new_mode = 'test_mode'
cmd.new_filename = 'test_filename'
cmd.do()
model.set_diff_text.assert_called_once_with('test_diff_text')
model.set_diff_type.assert_called_once_with('test_diff_type')
model.set_mode.assert_called_once_with('test_mode')
assert model.filename == 'test_filename'
@patch('cola.interaction.Interaction.confirm')
def test_submodule_add(confirm):
# "git submodule" should not be called if the answer is "no"
context = Mock()
url = 'url'
path = ''
reference = ''
branch = ''
depth = 0
cmd = cmds.SubmoduleAdd(context, url, path, branch, depth, reference)
confirm.return_value = False
cmd.do()
assert not context.git.submodule.called
expect = ['--', 'url']
actual = cmd.get_args()
assert expect == actual
cmd.path = 'path'
expect = ['--', 'url', 'path']
actual = cmd.get_args()
assert expect == actual
cmd.reference = 'ref'
expect = ['--reference', 'ref', '--', 'url', 'path']
actual = cmd.get_args()
assert expect == actual
cmd.branch = 'branch'
expect = ['--branch', 'branch', '--reference', 'ref', '--', 'url', 'path']
actual = cmd.get_args()
assert expect == actual
cmd.reference = ''
cmd.branch = ''
cmd.depth = 1
expect = ['--depth', '1', '--', 'url', 'path']
actual = cmd.get_args()
assert expect == actual
# Run the command and assert that "git submodule" was called.
confirm.return_value = True
context.git.submodule.return_value = (0, '', '')
cmd.do()
context.git.submodule.assert_called_once_with('add', *expect)
assert context.model.update_file_status.called
assert context.model.update_submodules_list.called
@patch('cola.version.check_git')
@patch('cola.interaction.Interaction.confirm')
def test_submodule_update(confirm, check_git):
context = Mock()
path = 'sub/path'
update_path_cmd = cmds.SubmoduleUpdate(context, path)
update_all_cmd = cmds.SubmodulesUpdate(context)
# Nothing is called when confirm() returns False.
confirm.return_value = False
update_path_cmd.do()
assert not context.git.submodule.called
update_all_cmd.do()
assert not context.git.submodule.called
# Confirm command execution.
confirm.return_value = True
# Test the old command-line arguments first
check_git.return_value = False
expect = ['update', '--', 'sub/path']
actual = update_path_cmd.get_args()
assert expect == actual
context.model.update_file_status = Mock()
context.git.submodule = Mock(return_value=(0, '', ''))
update_path_cmd.do()
context.git.submodule.assert_called_once_with(*expect)
assert context.model.update_file_status.called
expect = ['update']
actual = update_all_cmd.get_args()
assert expect == actual
context.model.update_file_status = Mock()
context.git.submodule = Mock(return_value=(0, '', ''))
update_all_cmd.do()
context.git.submodule.assert_called_once_with(*expect)
assert context.model.update_file_status.called
# Test the new command-line arguments (git v1.6.5+)
check_git.return_value = True
expect = ['update', '--recursive', '--', 'sub/path']
actual = update_path_cmd.get_args()
assert expect == actual
context.model.update_file_status = Mock()
context.git.submodule = Mock(return_value=(0, '', ''))
update_path_cmd.do()
context.git.submodule.assert_called_once_with(*expect)
assert context.model.update_file_status.called
expect = ['update', '--recursive']
actual = update_all_cmd.get_args()
assert expect == actual
context.model.update_file_status = Mock()
context.git.submodule = Mock(return_value=(0, '', ''))
update_all_cmd.do()
context.git.submodule.assert_called_once_with(*expect)
assert context.model.update_file_status.called
@patch('cola.cmds.Interaction')
@patch('cola.cmds.prefs')
def test_undo_last_commit_confirms_action(prefs, interaction):
"""Test the behavior around confirmation of UndoLastCommit actions"""
context = Mock()
context.model = Mock()
# First, test what happens when the commit is published and we say "yes".
prefs.check_published_commits = Mock(return_value=True)
context.model.is_commit_published = Mock(return_value=True)
interaction.confirm = Mock(return_value=True)
cmd = cmds.UndoLastCommit(context)
assert cmd.confirm()
context.model.is_commit_published.assert_called_once()
interaction.confirm.assert_called_once()
# Now, test what happens when we say "no".
interaction.confirm = Mock(return_value=False)
assert not cmd.confirm()
interaction.confirm.assert_called_once()
# Now check what happens when the commit is published but our preferences
# say to not check for published commits.
prefs.check_published_commits = Mock(return_value=False)
context.model.is_commit_published = Mock(return_value=True)
interaction.confirm = Mock(return_value=True)
assert cmd.confirm()
context.model.is_commit_published.assert_not_called()
interaction.confirm.assert_called_once()
# Lastly, check what when the commit is not published and we do check
# for published commits.
prefs.check_published_commits = Mock(return_value=True)
context.model.is_commit_published = Mock(return_value=False)
interaction.confirm = Mock(return_value=True)
assert cmd.confirm()
context.model.is_commit_published.assert_called_once()
interaction.confirm.assert_called_once()
| 7,046
|
Python
|
.py
| 170
| 36.582353
| 78
| 0.692105
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| true
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:55Z",
"metrics": {
"/tmp/tmpefqokizm.py": {
"CONFIDENCE.HIGH": 28,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 28,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 158,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 28,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 28,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 158,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "13 actual = cmds.Commit.strip_comments(msg)\n14 assert expect == actual\n15 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 14,
"line_range": [
14
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "21 actual = cmds.Commit.strip_comments(msg)\n22 assert expect == actual\n23 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 22,
"line_range": [
22
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "28 actual = cmds.unix_path(path, is_win32=lambda: True)\n29 assert expect == actual\n30 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 29,
"line_range": [
29
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "35 actual = cmds.unix_path(path, is_win32=lambda: True)\n36 assert expect == actual\n37 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 36,
"line_range": [
36
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "42 actual = cmds.unix_path(path, is_win32=lambda: False)\n43 assert expect == actual\n44 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 43,
"line_range": [
43
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "59 model.set_mode.assert_called_once_with('test_mode')\n60 assert model.filename == 'test_filename'\n61 \n",
"col_offset": 4,
"end_col_offset": 44,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 60,
"line_range": [
60
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "75 cmd.do()\n76 assert not context.git.submodule.called\n77 \n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 76,
"line_range": [
76
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "79 actual = cmd.get_args()\n80 assert expect == actual\n81 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 80,
"line_range": [
80
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "84 actual = cmd.get_args()\n85 assert expect == actual\n86 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 85,
"line_range": [
85
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "89 actual = cmd.get_args()\n90 assert expect == actual\n91 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 90,
"line_range": [
90
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "94 actual = cmd.get_args()\n95 assert expect == actual\n96 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 95,
"line_range": [
95
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "101 actual = cmd.get_args()\n102 assert expect == actual\n103 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 102,
"line_range": [
102
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "108 context.git.submodule.assert_called_once_with('add', *expect)\n109 assert context.model.update_file_status.called\n110 assert context.model.update_submodules_list.called\n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 109,
"line_range": [
109
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "109 assert context.model.update_file_status.called\n110 assert context.model.update_submodules_list.called\n111 \n",
"col_offset": 4,
"end_col_offset": 54,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 110,
"line_range": [
110
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "124 update_path_cmd.do()\n125 assert not context.git.submodule.called\n126 \n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 125,
"line_range": [
125
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "127 update_all_cmd.do()\n128 assert not context.git.submodule.called\n129 \n",
"col_offset": 4,
"end_col_offset": 43,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 128,
"line_range": [
128
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "137 actual = update_path_cmd.get_args()\n138 assert expect == actual\n139 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 138,
"line_range": [
138
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "143 context.git.submodule.assert_called_once_with(*expect)\n144 assert context.model.update_file_status.called\n145 \n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 144,
"line_range": [
144
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "147 actual = update_all_cmd.get_args()\n148 assert expect == actual\n149 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 148,
"line_range": [
148
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "153 context.git.submodule.assert_called_once_with(*expect)\n154 assert context.model.update_file_status.called\n155 \n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 154,
"line_range": [
154
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "160 actual = update_path_cmd.get_args()\n161 assert expect == actual\n162 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 161,
"line_range": [
161
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "166 context.git.submodule.assert_called_once_with(*expect)\n167 assert context.model.update_file_status.called\n168 \n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 167,
"line_range": [
167
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "170 actual = update_all_cmd.get_args()\n171 assert expect == actual\n172 \n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 171,
"line_range": [
171
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "176 context.git.submodule.assert_called_once_with(*expect)\n177 assert context.model.update_file_status.called\n178 \n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 177,
"line_range": [
177
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "191 cmd = cmds.UndoLastCommit(context)\n192 assert cmd.confirm()\n193 context.model.is_commit_published.assert_called_once()\n",
"col_offset": 4,
"end_col_offset": 24,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 192,
"line_range": [
192
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "197 interaction.confirm = Mock(return_value=False)\n198 assert not cmd.confirm()\n199 interaction.confirm.assert_called_once()\n",
"col_offset": 4,
"end_col_offset": 28,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 198,
"line_range": [
198
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "206 \n207 assert cmd.confirm()\n208 context.model.is_commit_published.assert_not_called()\n",
"col_offset": 4,
"end_col_offset": 24,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 207,
"line_range": [
207
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "216 \n217 assert cmd.confirm()\n218 context.model.is_commit_published.assert_called_once()\n",
"col_offset": 4,
"end_col_offset": 24,
"filename": "/tmp/tmpefqokizm.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 217,
"line_range": [
217
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
8
|
display_test.py
|
git-cola_git-cola/test/display_test.py
|
from cola import display
def test_shorten_paths():
paths = (
'/usr/src/git-cola/src',
'/usr/src/example/src',
'/usr/src/super/lib/src',
'/usr/src/super/tools/src',
'/usr/src/super/example/src',
'/lib/src',
)
actual = display.shorten_paths(paths)
assert actual[paths[0]] == 'git-cola/src'
assert actual[paths[1]] == 'src/example/src'
assert actual[paths[2]] == 'super/lib/src'
assert actual[paths[3]] == 'tools/src'
assert actual[paths[4]] == 'super/example/src'
assert actual[paths[5]] == '/lib/src'
def test_normalize_path():
path = r'C:\games\doom2'
expect = 'C:/games/doom2'
actual = display.normalize_path(path)
assert expect == actual
| 744
|
Python
|
.py
| 22
| 28.090909
| 50
| 0.615599
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
|
{
"errors": [],
"generated_at": "2025-07-09T10:20:56Z",
"metrics": {
"/tmp/tmp4bbfyah4.py": {
"CONFIDENCE.HIGH": 7,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 7,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 22,
"nosec": 0,
"skipped_tests": 0
},
"_totals": {
"CONFIDENCE.HIGH": 7,
"CONFIDENCE.LOW": 0,
"CONFIDENCE.MEDIUM": 0,
"CONFIDENCE.UNDEFINED": 0,
"SEVERITY.HIGH": 0,
"SEVERITY.LOW": 7,
"SEVERITY.MEDIUM": 0,
"SEVERITY.UNDEFINED": 0,
"loc": 22,
"nosec": 0,
"skipped_tests": 0
}
},
"results": [
{
"code": "13 actual = display.shorten_paths(paths)\n14 assert actual[paths[0]] == 'git-cola/src'\n15 assert actual[paths[1]] == 'src/example/src'\n",
"col_offset": 4,
"end_col_offset": 45,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 14,
"line_range": [
14
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "14 assert actual[paths[0]] == 'git-cola/src'\n15 assert actual[paths[1]] == 'src/example/src'\n16 assert actual[paths[2]] == 'super/lib/src'\n",
"col_offset": 4,
"end_col_offset": 48,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 15,
"line_range": [
15
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "15 assert actual[paths[1]] == 'src/example/src'\n16 assert actual[paths[2]] == 'super/lib/src'\n17 assert actual[paths[3]] == 'tools/src'\n",
"col_offset": 4,
"end_col_offset": 46,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 16,
"line_range": [
16
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "16 assert actual[paths[2]] == 'super/lib/src'\n17 assert actual[paths[3]] == 'tools/src'\n18 assert actual[paths[4]] == 'super/example/src'\n",
"col_offset": 4,
"end_col_offset": 42,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 17,
"line_range": [
17
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "17 assert actual[paths[3]] == 'tools/src'\n18 assert actual[paths[4]] == 'super/example/src'\n19 assert actual[paths[5]] == '/lib/src'\n",
"col_offset": 4,
"end_col_offset": 50,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 18,
"line_range": [
18
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "18 assert actual[paths[4]] == 'super/example/src'\n19 assert actual[paths[5]] == '/lib/src'\n20 \n",
"col_offset": 4,
"end_col_offset": 41,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 19,
"line_range": [
19
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
},
{
"code": "25 actual = display.normalize_path(path)\n26 assert expect == actual\n",
"col_offset": 4,
"end_col_offset": 27,
"filename": "/tmp/tmp4bbfyah4.py",
"issue_confidence": "HIGH",
"issue_cwe": {
"id": 703,
"link": "https://cwe.mitre.org/data/definitions/703.html"
},
"issue_severity": "LOW",
"issue_text": "Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.",
"line_number": 26,
"line_range": [
26
],
"more_info": "https://bandit.readthedocs.io/en/1.7.10/plugins/b101_assert_used.html",
"test_id": "B101",
"test_name": "assert_used"
}
]
}
|
9
|
gitcmds_test.py
|
git-cola_git-cola/test/gitcmds_test.py
| "\"\"\"Test the cola.gitcmds module\"\"\"\nimport os\n\nfrom cola import core\nfrom cola import gitc(...TRUNCATED)
| 7,264
|
Python
|
.py
| 171
| 37.391813
| 88
| 0.66856
|
git-cola/git-cola
| 2,239
| 455
| 69
|
GPL-2.0
|
9/5/2024, 5:06:50 PM (Europe/Amsterdam)
| false
| false
| false
| false
| false
| false
| false
| true
| false
| false
| "{\n \"errors\": [],\n \"generated_at\": \"2025-07-09T10:20:56Z\",\n \"metrics\": {\n \"/tmp/t(...TRUNCATED)
|
End of preview. Expand
in Data Studio
No dataset card yet
- Downloads last month
- 20