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

[bug] Doesn't extract puzzles from JS files that has a shebang #214

Closed
php-coder opened this issue Oct 27, 2022 · 14 comments
Closed

[bug] Doesn't extract puzzles from JS files that has a shebang #214

php-coder opened this issue Oct 27, 2022 · 14 comments

Comments

@php-coder
Copy link
Contributor

php-coder commented Oct 27, 2022

(Initially submitted against 0pdd but it has been discovered that it's a bug in pdd: yegor256/0pdd#395)

pdd doesn't extract puzzles from JS code. Here are the examples:

$ git grep -n @todo
src/cli.js:16:        // @todo #24 Document --dest-dir option
src/cli.js:102:            // @todo #27 Document usage of user defined routes
src/cli.js:118:    // @todo #28 Create db.py with async API
src/cli.js:301:    // @todo #24 [js] Possibly incorrect project name with --dest-dir option

At GitHub: https://github.com/php-coder/query2app/blob/27ffed4faa098b8ba006c51b0a3fc8db5552eb7d/src/cli.js#L16

It's supposed that pdd should find these puzzles and create issues for them but it didn't find puzzles there.

@php-coder
Copy link
Contributor Author

Hm, perhaps there is no colon after ticket number?!..

@php-coder
Copy link
Contributor Author

Any updates on this?

@php-coder
Copy link
Contributor Author

I ran pdd manually and it complain that this is a binary file:

/data/src/cli.js is a binary file (11908 bytes)

@php-coder
Copy link
Contributor Author

php-coder commented Jun 29, 2023

It looks like pdd expects that a file type will contain text/ substring

https://github.com/cqfn/pdd/blob/63948d268b9c82c5e37faae3cd1341d07aad7385/lib/pdd/sources.rb#L90C41-L91

while in this case it doesn't:

$ file src/cli.js
src/cli.js: a /usr/bin/env node script text executable, ASCII text

@php-coder
Copy link
Contributor Author

Nope, the theory doesn't work:

$ file --mime src/cli.js
src/cli.js: text/plain; charset=us-ascii

@php-coder
Copy link
Contributor Author

I debugged it and I found that fm.file(file) returns application/javascript; charset=us-ascii for that file:

/data/src/cli.js has MIME type: application/javascript; charset=us-ascii

Most likely, because it has the following shebang:

$ head -1 src/cli.js
#!/usr/bin/env node

@php-coder
Copy link
Contributor Author

I confirm: removing a shebang, did the trick -- pdd found all the puzzles in this file.

@php-coder php-coder changed the title Doesn't extract puzzles from JS code Doesn't extract puzzles from JS file with a shebang Jun 29, 2023
@php-coder php-coder changed the title Doesn't extract puzzles from JS file with a shebang [bug] Doesn't extract puzzles from JS files that has a shebang Jun 29, 2023
@php-coder
Copy link
Contributor Author

@yegor256 Hi Egor, I don't see any activity in this repository. Is the project still maintained?

@yegor256
Copy link
Member

@php-coder of course! The latest release was done six month ago. Let me check this bug today.

yegor256 added a commit that referenced this issue Jun 29, 2023
yegor256 added a commit that referenced this issue Jun 29, 2023
yegor256 added a commit that referenced this issue Jun 29, 2023
yegor256 added a commit that referenced this issue Jun 29, 2023
yegor256 added a commit that referenced this issue Jun 29, 2023
yegor256 added a commit that referenced this issue Jun 29, 2023
yegor256 added a commit that referenced this issue Jun 29, 2023
@yegor256
Copy link
Member

@rultor release, tag is 0.23.2

@rultor
Copy link
Collaborator

rultor commented Jun 29, 2023

@rultor release, tag is 0.23.2

@yegor256 OK, I will release it now. Please check the progress here

@rultor
Copy link
Collaborator

rultor commented Jun 29, 2023

@rultor release, tag is 0.23.2

@yegor256 Done! FYI, the full log is here (took me 2min)

@yegor256
Copy link
Member

@php-coder I believe it's fixed. I will release 0pdd soon: yegor256/0pdd#476

@php-coder
Copy link
Contributor Author

@yegor256 It was fast! Thanks!

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

No branches or pull requests

3 participants