FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix extracted lineno with nested calls by dylankiss · Pull Request #1126 · python-babel/babel · GitHub

Repository navigation

Fix extracted lineno with nested calls - #1126

Merged
akx merged 1 commit into
python-babel:masterfrom
dylankiss:fix-linenno-nested-call
Oct 19, 2024
Merged

akx merged 1 commit into
python-babel:masterfrom
dylankiss:fix-linenno-nested-call

Conversation

Copy link
Copy Markdown
Contributor

When a gettext call had a nested function call on a new line, the extract function would use that nested call's line number when extracting the terms for the gettext call.

The reason is that we set the line number on any encounter of an opening parenthesis after a gettext keyword. This does not work if either we have a nested call, or our first term starts on a new line.

This commit fixes that by only setting the line number when we encounter the first argument inside a gettext call.

Existing tests were adapted to work according to xgettext with regards to the line numbers.

Fixes #1123

akx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, thanks!

When a gettext call had a nested function call on a new line, the
extract function would use that nested call's line number when
extracting the terms for the gettext call.

The reason is that we set the line number on any encounter of an opening
parenthesis after a gettext keyword. This does not work if either we
have a nested call, or our first term starts on a new line.

This commit fixes that by only setting the line number when we encounter
the first argument inside a gettext call.

Existing tests were adapted to work according to `xgettext` with regards
to the line numbers.

Fixes python-babel#1123
akx force-pushed the fix-linenno-nested-call branch from 7095897 to 5795711 Compare October 19, 2024 12:14
akx enabled auto-merge (squash) October 19, 2024 12:14

codecov Bot commented Oct 19, 2024 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.31%. Comparing base (ea84d9d) to head (5795711).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1126   +/-   ##
=======================================
  Coverage   91.30%   91.31%           
=======================================
  Files          27       27           
  Lines        4610     4615    +5     
=======================================
+ Hits         4209     4214    +5     
  Misses        401      401           
Flag Coverage Δ
macos-12-3.10 90.07% <71.42%> (-0.04%) ⬇️
macos-12-3.11 90.01% <71.42%> (-0.04%) ⬇️
macos-12-3.12 90.22% <100.00%> (+0.01%) ⬆️
macos-12-3.13-dev 89.75% <100.00%> (+0.01%) ⬆️
macos-12-3.8 90.00% <71.42%> (-0.04%) ⬇️
macos-12-3.9 90.00% <71.42%> (-0.04%) ⬇️
macos-12-pypy3.10 90.07% <71.42%> (-0.04%) ⬇️
ubuntu-22.04-3.10 90.09% <71.42%> (-0.04%) ⬇️
ubuntu-22.04-3.11 90.03% <71.42%> (-0.04%) ⬇️
ubuntu-22.04-3.12 90.24% <100.00%> (+0.01%) ⬆️
ubuntu-22.04-3.13-dev 89.77% <100.00%> (+0.01%) ⬆️
ubuntu-22.04-3.8 90.02% <71.42%> (-0.04%) ⬇️
ubuntu-22.04-3.9 90.02% <71.42%> (-0.04%) ⬇️
ubuntu-22.04-pypy3.10 90.09% <71.42%> (-0.04%) ⬇️
windows-2022-3.10 90.21% <71.42%> (-0.04%) ⬇️
windows-2022-3.11 90.15% <71.42%> (-0.04%) ⬇️
windows-2022-3.12 90.36% <100.00%> (+0.01%) ⬆️
windows-2022-3.13-dev 89.89% <100.00%> (+0.01%) ⬆️
windows-2022-3.8 90.14% <71.42%> (-0.04%) ⬇️
windows-2022-3.9 90.14% <71.42%> (-0.04%) ⬇️
windows-2022-pypy3.10 90.21% <71.42%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extract: Wrong lineno when arguments are spread over multiple lines and contain a function call

2 participants


Back | FazBrowse Home | New Git URL