Skip to content

Commit f785b8b

Browse files
mvorisekmarkstory
andauthored
Fix references resolving (#60)
* Fix resolve for absolute reference names * move test/unit to test * move test/must-build to test * push changes to forks and only once per workflow * assert log using CI * fix method/property render /w explicit class name * remove dead code and prevent NS refetch * improve comments * refactor "modname" to "namespace" * refactor remaining module mentions * remove dead code * reserved names are never resolved using NS * "global" is for global variables only * stricter identifier matching in signature * improve separators def * log unable to parse signature * always resolve refs using namespace, never fallback to global * Enforce Coding Style using Black * "numeric" type is not reserved keyword * add mvorisek as coauthor * test warnings and non-zero exit code * fix ref type mismatch * fix .gitignore --------- Co-authored-by: Mark Story <mark@mark-story.com>
1 parent 76f0c62 commit f785b8b

33 files changed

+3535
-1179
lines changed

.github/workflows/ci.yml

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,66 @@ jobs:
3333
run: |
3434
python -m pip install --upgrade pip
3535
pip install -r requirements.txt
36-
pip install -r test/unit/requirements.txt
36+
pip install -r test/requirements.txt
3737
pip install .
3838
39-
- name: Build Test
39+
- name: Build Unit Tests
4040
run: |
41-
cd test/must-build && make html SPHINXOPTS='-W'
41+
cd test
42+
find . -name '*.html' -exec rm {} \;
4243
43-
- name: Build Test with toc show_parents=hide
44-
run: |
45-
cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide'
44+
sed -i 's~, "log\.md"~~' conf.py
45+
make html SPHINXOPTS='' 2>&1 | tee log.txt
46+
git restore conf.py
4647
47-
- name: Build Test with toc show_parents=domain
48-
run: |
49-
cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain'
50-
51-
- name: Build Test with toc show_parents=all
52-
run: |
53-
cd test/must-build && make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all'
48+
(cd _build/html && rm genindex.html index.html search.html php-modindex.html)
49+
(cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;)
50+
sed -i -r 's~.*/(test/)~\1~;t;d' log.txt
5451
55-
- name: Run Unit Testing
52+
- name: Apply Coding Style
53+
if: matrix.python == '3.11'
5654
run: |
57-
cd test/unit
58-
find . -name '*.html' -exec rm {} \;
59-
make html SPHINXOPTS='-W'
60-
(cd _build/html && find . -name '*.html' -exec sh -c 'xmllint {} --xpath '"'"'//div[@role="main"]'"'"' | xmllint --format - > ../../{}' \;)
61-
rm genindex.html index.html search.html php-modindex.html
55+
pip install black
56+
python -m black .
6257
63-
- name: Diff Unit Outputs
58+
- name: Diff Unit Tests Output and Coding Style
6459
run: |
65-
cd test/unit
60+
cd test
6661
rm -r _build
6762
git add . -N && git diff --exit-code
6863
69-
- name: Push Unit Changes
70-
if: failure()
64+
- name: Push Unit Tests Output
65+
if: failure() && github.repository_owner != 'markstory' && matrix.python == '3.11'
7166
uses: stefanzweifel/git-auto-commit-action@v4
7267
with:
7368
branch: ${{ github.head_ref || github.ref_name }}.changes
69+
create_branch: true
7470
push_options: '--force'
75-
commit_message: Unit Changes
71+
commit_message: Unit Tests Changes
7672
commit_user_name: Bot
7773
commit_user_email: bot@example.com
7874
commit_author: Bot <bot@example.com>
75+
76+
- name: Build Unit Tests with '-W' option
77+
run: |
78+
cd test
79+
make html SPHINXOPTS='-W'
80+
81+
sed -i 's~, "log\.md"~~' conf.py
82+
! make html SPHINXOPTS='-W' || (echo 'Unexpected zero exit code'; false)
83+
git restore conf.py
84+
85+
- name: Build Unit Tests with toc show_parents=hide
86+
run: |
87+
cd test
88+
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=hide'
89+
90+
- name: Build Unit Tests with toc show_parents=domain
91+
run: |
92+
cd test
93+
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=domain'
94+
95+
- name: Build Unit Tests with toc show_parents=all
96+
run: |
97+
cd test
98+
make html SPHINXOPTS='-W -D toc_object_entries_show_parents=all'

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
dist/
22
build/
33
doc/_build
4-
test/must-build/_build
5-
test/unit/_build
4+
test/_build
65
*.pyc
76
*.egg-info
87
.DS_Store

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ PHP Domain for Sphinx
22
#####################
33

44
:author: Mark Story <mark at mark-story.com>
5+
:author: Michael Voříšek
56

67
About
78
=====

doc/conf.py

Lines changed: 63 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,210 +1,207 @@
1-
# -*- coding: utf-8 -*-
2-
#
3-
# sphinxcontrib-rubydomain-acceptancetest documentation build configuration file, created by
4-
# sphinx-quickstart on Sun Apr 25 13:27:18 2010.
5-
#
6-
# This file is execfile()d with the current directory set to its containing dir.
7-
#
8-
# Note that not all possible configuration values are present in this
9-
# autogenerated file.
10-
#
11-
# All configuration values have a default; values that are commented out
12-
# serve to show the default.
13-
141
import sys, os
152

163
# If extensions (or modules to document with autodoc) are in another directory,
174
# add these directories to sys.path here. If the directory is relative to the
185
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
sys.path.append(os.path.abspath('..'))
6+
sys.path.append(os.path.abspath(".."))
207

218
# -- General configuration -----------------------------------------------------
229

2310
# If your documentation needs a minimal Sphinx version, state it here.
24-
needs_sphinx = '1.0'
11+
needs_sphinx = "1.0"
2512

2613
# Add any Sphinx extension module names here, as strings. They can be extensions
2714
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
28-
extensions = ['sphinxcontrib.phpdomain']
15+
extensions = ["sphinxcontrib.phpdomain"]
2916

3017
# Add any paths that contain templates here, relative to this directory.
31-
templates_path = ['_templates']
18+
templates_path = ["_templates"]
3219

3320
# The suffix of source filenames.
34-
source_suffix = '.rst'
21+
source_suffix = ".rst"
3522

3623
# The encoding of source files.
37-
#source_encoding = 'utf-8-sig'
24+
# source_encoding = 'utf-8-sig'
3825

3926
# The master toctree document.
40-
master_doc = 'index'
27+
master_doc = "index"
4128

4229
# General information about the project.
43-
project = u'sphinxcontrib-phpdomain'
44-
copyright = u'2011, Mark Story'
30+
project = "sphinxcontrib-phpdomain"
31+
copyright = "2011 - 2023, Mark Story and Michael Voříšek"
4532

4633
# The version info for the project you're documenting, acts as replacement for
4734
# |version| and |release|, also used in various other places throughout the
4835
# built documents.
4936
#
5037
# The short X.Y version.
51-
version = '0.1'
38+
version = "0.1"
5239
# The full version, including alpha/beta/rc tags.
53-
release = '0.1'
40+
release = "0.1"
5441

5542
# The language for content autogenerated by Sphinx. Refer to documentation
5643
# for a list of supported languages.
57-
#language = None
44+
# language = None
5845

5946
# There are two options for replacing |today|: either, you set today to some
6047
# non-false value, then it is used:
61-
#today = ''
48+
# today = ''
6249
# Else, today_fmt is used as the format for a strftime call.
63-
#today_fmt = '%B %d, %Y'
50+
# today_fmt = '%B %d, %Y'
6451

6552
# List of patterns, relative to source directory, that match files and
6653
# directories to ignore when looking for source files.
67-
exclude_patterns = ['_build']
54+
exclude_patterns = ["_build"]
6855

6956
# The reST default role (used for this markup: `text`) to use for all documents.
70-
#default_role = None
57+
# default_role = None
7158

7259
# If true, '()' will be appended to :func: etc. cross-reference text.
73-
#add_function_parentheses = True
60+
# add_function_parentheses = True
7461

7562
# If true, the current module name will be prepended to all description
7663
# unit titles (such as .. function::).
77-
#add_module_names = True
64+
# add_module_names = True
7865

7966
# If true, sectionauthor and moduleauthor directives will be shown in the
8067
# output. They are ignored by default.
81-
#show_authors = False
68+
# show_authors = False
8269

8370
# The name of the Pygments (syntax highlighting) style to use.
84-
pygments_style = 'sphinx'
71+
pygments_style = "sphinx"
8572

8673
# A list of ignored prefixes for module index sorting.
87-
#modindex_common_prefix = []
74+
# modindex_common_prefix = []
8875

8976

9077
# -- Options for HTML output ---------------------------------------------------
9178

9279
# The theme to use for HTML and HTML Help pages. Major themes that come with
9380
# Sphinx are currently 'default' and 'sphinxdoc'.
94-
html_theme = 'sphinxdoc'
81+
html_theme = "sphinxdoc"
9582

9683
# Theme options are theme-specific and customize the look and feel of a theme
9784
# further. For a list of options available for each theme, see the
9885
# documentation.
99-
#html_theme_options = {}
86+
# html_theme_options = {}
10087

10188
# Add any paths that contain custom themes here, relative to this directory.
102-
#html_theme_path = []
89+
# html_theme_path = []
10390

10491
# The name for this set of Sphinx documents. If None, it defaults to
10592
# "<project> v<release> documentation".
106-
#html_title = None
93+
# html_title = None
10794

10895
# A shorter title for the navigation bar. Default is the same as html_title.
109-
#html_short_title = None
96+
# html_short_title = None
11097

11198
# The name of an image file (relative to this directory) to place at the top
11299
# of the sidebar.
113-
#html_logo = None
100+
# html_logo = None
114101

115102
# The name of an image file (within the static path) to use as favicon of the
116103
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117104
# pixels large.
118-
#html_favicon = None
105+
# html_favicon = None
119106

120107
# Add any paths that contain custom static files (such as style sheets) here,
121108
# relative to this directory. They are copied after the builtin static files,
122109
# so a file named "default.css" will overwrite the builtin "default.css".
123-
#html_static_path = ['_static']
110+
# html_static_path = ['_static']
124111

125112
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126113
# using the given strftime format.
127-
#html_last_updated_fmt = '%b %d, %Y'
114+
# html_last_updated_fmt = '%b %d, %Y'
128115

129116
# If true, SmartyPants will be used to convert quotes and dashes to
130117
# typographically correct entities.
131-
#html_use_smartypants = True
118+
# html_use_smartypants = True
132119

133120
# Custom sidebar templates, maps document names to template names.
134-
#html_sidebars = {}
121+
# html_sidebars = {}
135122

136123
# Additional templates that should be rendered to pages, maps page names to
137124
# template names.
138-
#html_additional_pages = {}
125+
# html_additional_pages = {}
139126

140127
# If false, no module index is generated.
141-
#html_domain_indices = True
128+
# html_domain_indices = True
142129

143130
# If false, no index is generated.
144-
#html_use_index = True
131+
# html_use_index = True
145132

146133
# If true, the index is split into individual pages for each letter.
147-
#html_split_index = False
134+
# html_split_index = False
148135

149136
# If true, links to the reST sources are added to the pages.
150-
#html_show_sourcelink = True
137+
# html_show_sourcelink = True
151138

152139
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
153-
#html_show_sphinx = True
140+
# html_show_sphinx = True
154141

155142
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
156-
#html_show_copyright = True
143+
# html_show_copyright = True
157144

158145
# If true, an OpenSearch description file will be output, and all pages will
159146
# contain a <link> tag referring to it. The value of this option must be the
160147
# base URL from which the finished HTML is served.
161-
#html_use_opensearch = ''
148+
# html_use_opensearch = ''
162149

163150
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
164-
#html_file_suffix = ''
151+
# html_file_suffix = ''
165152

166153
# Output file base name for HTML help builder.
167-
htmlhelp_basename = 'sphinxcontrib-phpdomain'
154+
htmlhelp_basename = "sphinxcontrib-phpdomain"
168155

169156

170157
# -- Options for LaTeX output --------------------------------------------------
171158

172159
# The paper size ('letter' or 'a4').
173-
#latex_paper_size = 'letter'
160+
# latex_paper_size = 'letter'
174161

175162
# The font size ('10pt', '11pt' or '12pt').
176-
#latex_font_size = '10pt'
163+
# latex_font_size = '10pt'
177164

178165
# Grouping the document tree into LaTeX files. List of tuples
179166
# (source start file, target name, title, author, documentclass [howto/manual]).
180167
latex_documents = [
181-
('index', 'sphinxcontrib-phpdomain.tex', u'sphinxcontrib-phpdomain Documentation',
182-
u'Mark Story', 'manual'),
168+
(
169+
"index",
170+
"sphinxcontrib-phpdomain.tex",
171+
"sphinxcontrib-phpdomain Documentation",
172+
"Mark Story and Michael Voříšek",
173+
"manual",
174+
),
183175
]
184176

185177
# The name of an image file (relative to this directory) to place at the top of
186178
# the title page.
187-
#latex_logo = None
179+
# latex_logo = None
188180

189181
# For "manual" documents, if this is true, then toplevel headings are parts,
190182
# not chapters.
191-
#latex_use_parts = False
183+
# latex_use_parts = False
192184

193185
# Additional stuff for the LaTeX preamble.
194-
#latex_preamble = ''
186+
# latex_preamble = ''
195187

196188
# Documents to append as an appendix to all manuals.
197-
#latex_appendices = []
189+
# latex_appendices = []
198190

199191
# If false, no module index is generated.
200-
#latex_domain_indices = True
192+
# latex_domain_indices = True
201193

202194

203195
# -- Options for manual page output --------------------------------------------
204196

205197
# One entry per manual page. List of tuples
206198
# (source start file, name, description, authors, manual section).
207199
man_pages = [
208-
('index', 'sphinxcontrib-phpdomain', u'sphinxcontrib-phpdomain Documentation',
209-
[u'Mark Story'], 1)
200+
(
201+
"index",
202+
"sphinxcontrib-phpdomain",
203+
"sphinxcontrib-phpdomain Documentation",
204+
["Mark Story and Michael Voříšek"],
205+
1,
206+
)
210207
]

0 commit comments

Comments
 (0)