Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Add lineno to default output of needs.json #1346

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion docs/ubproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
"$schema" = "https://ubcode.useblocks.com/ubproject.schema.json"

[parse.extend_directives.need-example]
argument = true
options = true
content = true
parse_content = true
content_required = true

[needs]
extra_options = [
"my_extra_option",
Expand All @@ -17,7 +26,7 @@ show_link_type = false
show_link_title = false
title_optional = true
max_title_length = 75
id_regex = "^[A-Za-z0-9_]*"
id_regex = "^[A-Za-z0-9_]+"
id_required = false
table_style = "datatables"
table_columns = "ID;TITLE;STATUS;OUTGOING"
Expand Down
1 change: 0 additions & 1 deletion sphinx_needs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ class CoreFieldParameters(TypedDict):
"lineno": {
"description": "Line number where the need is defined (None if external).",
"schema": {"type": ["integer", "null"], "default": None},
"exclude_json": True,
"exclude_external": True,
"exclude_import": True,
},
Expand Down
3 changes: 3 additions & 0 deletions tests/__snapshots__/test_add_sections_sigs.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'impacts': 'component_a',
'introduced': '1.0.0',
'layout': '',
'lineno': 9,
'section_name': '1.1 First Section',
'sections': list([
'1.1 First Section',
Expand All @@ -32,6 +33,7 @@
'impacts': 'component_b',
'introduced': '1.1.1',
'layout': '',
'lineno': 20,
'section_name': '1.2 Second Section',
'sections': list([
'1.2 Second Section',
Expand All @@ -52,6 +54,7 @@
'full_title': 'test method',
'id': 'T_001',
'layout': '',
'lineno': 40,
'section_name': '1.3 need in API',
'sections': list([
'1.3 need in API',
Expand Down
11 changes: 11 additions & 0 deletions tests/__snapshots__/test_basic_doc.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 4,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -103,6 +104,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 8,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -329,6 +331,15 @@
'null',
]),
}),
'lineno': dict({
'default': None,
'description': 'Line number where the need is defined (None if external).',
'field_type': 'core',
'type': list([
'integer',
'null',
]),
}),
'links': dict({
'default': list([
]),
Expand Down
24 changes: 24 additions & 0 deletions tests/__snapshots__/test_external.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'full_title': 'REQ_01',
'id': 'IMP_REQ_01',
'layout': '',
'lineno': 4,
'section_name': 'Title',
'sections': list([
'Title',
Expand Down Expand Up @@ -220,6 +221,15 @@
'null',
]),
}),
'lineno': dict({
'default': None,
'description': 'Line number where the need is defined (None if external).',
'field_type': 'core',
'type': list([
'integer',
'null',
]),
}),
'links': dict({
'default': list([
]),
Expand Down Expand Up @@ -497,6 +507,7 @@
'is_part': False,
'jinja_content': False,
'layout': None,
'lineno': None,
'links': list([
'SPEC_1',
]),
Expand Down Expand Up @@ -569,6 +580,7 @@
'is_part': False,
'jinja_content': False,
'layout': None,
'lineno': None,
'links': list([
'EXT_TEST_01',
'REQ_1',
Expand Down Expand Up @@ -644,6 +656,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 9,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -715,6 +728,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 12,
'links': list([
'REQ_1',
'EXT_TEST_01',
Expand Down Expand Up @@ -787,6 +801,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 4,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -1013,6 +1028,15 @@
'null',
]),
}),
'lineno': dict({
'default': None,
'description': 'Line number where the need is defined (None if external).',
'field_type': 'core',
'type': list([
'integer',
'null',
]),
}),
'links': dict({
'default': list([
]),
Expand Down
11 changes: 11 additions & 0 deletions tests/__snapshots__/test_extra_options.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'impacts': 'component_a',
'introduced': '1.0.0',
'layout': '',
'lineno': 7,
'section_name': 'Section 1',
'sections': list([
'Section 1',
Expand All @@ -36,6 +37,7 @@
'impacts': 'component_b',
'introduced': '1.1.1',
'layout': '',
'lineno': 16,
'section_name': 'Section 1',
'sections': list([
'Section 1',
Expand Down Expand Up @@ -250,6 +252,15 @@
'null',
]),
}),
'lineno': dict({
'default': None,
'description': 'Line number where the need is defined (None if external).',
'field_type': 'core',
'type': list([
'integer',
'null',
]),
}),
'links': dict({
'default': list([
]),
Expand Down
17 changes: 17 additions & 0 deletions tests/__snapshots__/test_need_constraints.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 20,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -109,6 +110,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 25,
'links': list([
'SECURITY_REQ',
]),
Expand Down Expand Up @@ -185,6 +187,7 @@
'is_part': False,
'jinja_content': False,
'layout': 'debug',
'lineno': 32,
'links': list([
'SECURITY_REQ',
]),
Expand Down Expand Up @@ -259,6 +262,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 39,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -328,6 +332,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 4,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -404,6 +409,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 11,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -480,6 +486,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 4,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -553,6 +560,7 @@
'is_part': False,
'jinja_content': False,
'layout': '',
'lineno': 11,
'links': list([
]),
'links_back': list([
Expand Down Expand Up @@ -779,6 +787,15 @@
'null',
]),
}),
'lineno': dict({
'default': None,
'description': 'Line number where the need is defined (None if external).',
'field_type': 'core',
'type': list([
'integer',
'null',
]),
}),
'links': dict({
'default': list([
]),
Expand Down
2 changes: 2 additions & 0 deletions tests/__snapshots__/test_need_parts.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'full_title': 'Command line interface',
'id': 'SP_TOO_001',
'layout': '',
'lineno': 4,
'parent_needs_back': list([
'TEST_2',
]),
Expand Down Expand Up @@ -100,6 +101,7 @@
'full_title': 'TEST_2',
'id': 'TEST_2',
'layout': '',
'lineno': 21,
'parent_need': 'SP_TOO_001',
'parent_needs': list([
'SP_TOO_001',
Expand Down
Loading
Loading