fix(halstead): Perl __END__ data section counted as one operand
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in big-code-analysis-ast/src/getter/perl.rs at the P::SpecialLiteral operand arm, then inspect the tree-sitter node children shown in the issue to distinguish special variables from __END__ and __DATA__ sections. Check the existing Perl operand tests and add cases for both markers with trailing data; done means those sections add no operand while supported special variables remain operands. The issue also asks whether tokens should count the section, so check its existing tests and document the behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
tree-sitter-perl wraps __END__ / __DATA__ and the whole data section after it in one special_literal node, the same kind it uses for __FILE__. The Perl getter classifies P::SpecialLiteral as an operand (big-code-analysis-ast/src/getter/perl.rs, the operand arm), so the marker plus every byte after it becomes one Halstead operand. Its text is the section's contents, so two files that differ only in their data section have different operand sets.
package P;
1;
__END__
aaa
bca dump:
╰─ {special_literal:220} from (3, 1) to (5, 1)
├─ {__END__:8} from (3, 1) to (3, 8) : __END__
╰─ {data_not_for_compiler:212} from (3, 8) to (5, 1)
bca ops lists an operand __END__\naaa\n; dropping __END__ from a file removes one operand (noend.pm 3 unique / 4 total vs end.pm 4 / 5 with the same code). tokens also grows by 2 (__END__ + data_not_for_compiler).
Expected
__END__ / __DATA__ end the program; neither they nor the data after them are operators or operands. Gate the SpecialLiteral operand arm on the child being __FILE__ / __LINE__ / __PACKAGE__ / __SUB__ (or exclude the END / DATA children), and decide whether tokens should count the section.
Found while fixing #1608 (LOC side of the same node).
- Dominant language
- Rust
- Stars
- 32
- Forks
- 3
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 48
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dekobon/big-code-analysis
-
bug python vcs
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
dekobon/big-code-analysis#1624 · 1 comment ·
Maintainers usually reply within 1 day
-
cli documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
dekobon/big-code-analysis#1485 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 85/100
dekobon/big-code-analysis#1484 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
dekobon/big-code-analysis#1458 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
dekobon/big-code-analysis#1444 ·
Maintainers usually reply within 1 day
All issues in dekobon/big-code-analysis
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
longbridge/gpui-kit#3620 ·
Maintainers usually reply within 1 day
-
corro-client drops the last byte of a response line that has no trailing newlinePossibly taken @RaphaelFakhri claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
proxy: include denial_category in the "proxy request denied" log linePossibly taken @sreyas-endor claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
nolabs-ai/nono#2172 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
metasequoiaime/msime#9113 ·
Maintainers usually reply within 1 day
-
[Enhancement] Make use of available space to display more processes when maximized in Memory pageOpen
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pop-os/cosmic-monitor#126 ·
Maintainers usually reply within 1 day