Giter VIP home page Giter VIP logo

zsh-sweep's Issues

Installation instructions don't seem to work

I've tried following various versions of the installation instructions; they don't seem to work.

Recreation (this isn't the standard installation method but to illustrate the problem):

  • git clone https://github.com/psprint/zsh-sweep <some_temporary_dir>
  • cd <some_temporary_dir>
  • source zsh-sweep.plugin.zsh
  • zsweep <some_zsh_file>

Gives:

  • zsh: command not found: zsweep

This is with zsh 5.8.1 (x86_64-apple-darwin21.0)

Am I using it right?

Integrating into Visual Studio Code

I'm wondering if anyone has considered integrating zsh-sweep into Visual Studio Code? I'm in the process of researching it, but figured I'd ask if anyone has done it already.

Error when sourcing

When I add

zs_set_path=1
source /Users/fharper/zsh-sweep/zsh-sweep.plugin.zsh

to my ~/.zshrc, I get this error util/zs::setup-aliases:29: scalar parameter REPLY created globally in function util/zs::setup-aliases and the command doesn't exist, which I assume it's because the aliases weren't created.

Any idea what is causing this?

--

macOS 13.3 build 22E252 on arm64
zsh 5.9 (x86_64-apple-darwin22.0)

FUNCTION_SETS_GLOBAL_VARS does not understand context

The global vars check creates a lot of false positives because of how simple it is. It seems to ignore almost all context. Consider this example:

(
  a='a'
)

bar() (
  b='b'
)

c='c' true

local arr=(
  d='d'
)

e='e'; export e

python - <<'EOF'
f='f'
print(f)
EOF

All of those variable-like patterns should be fine ('d' and 'f' are not even variables), but zsh-sweep complains about all of them. 'f' is the most problematic, because it's not always practical to add a shell-style comment inside of a heredoc in order to suppress it. Another problem is that zsh-sweep complains about implicitly global variables being set outside of functions, even in --script mode, where there is no practical difference between local and global AFAIK.

Notice: running check: CHECK_FUNCTION_SETS_GLOBAL_VARS_PRE…
Notice: running check: CHECK_FUNCTION_SETS_GLOBAL_VARS_POST…
[ZSweep][zsfilt:184]: Error: Error near line #2 ↔  a='a':
[ZSweep][zsfilt:184]: Error: Error near line #6 ↔  b='b':
[ZSweep][zsfilt:184]: Error: Error near line #9 ↔ c='c' true:
[ZSweep][zsfilt:184]: Error: Error near line #12 ↔  d='d':
[ZSweep][zsfilt:184]: Error: Error near line #15 ↔ e='e'; export e:
[ZSweep][zsfilt:184]: Error: Error near line #18 ↔ f='f':
[ZSweep][zscan:125]: Warning: A global variable has been created without declaration, by assignment. Add a line like local VAR or typeset -g VAR so that the variable is defined before use.

Less concerning are the false negatives like this, which zsh-sweep does not see as variables:

{ a='a' }

foo() { b='b' }

command not found: tigmsg

It seems like get-prj-dir is trying to print something, but can't because there is no function named tigmsg:

util/zs::get-prj-dir:30: command not found: tigmsg

Document Error Codes like Shellcheck

This was proposed on Reddit.

https://www.reddit.com/r/zsh/comments/10nb0y0/announcing_zshscan_a_zshlinter_zsh/

I like how shellcheck assigns each type of error or warning with a code, that optimistically corresponds to a page on their wiki to read more about it.

So for example with zsh-sweep, it tells me:

Notice: running check: CHECK_ZERO_ASSIGNMENT…
[ZSweep][zscan:125]: Warning: $0 assignment is missing, it should be:
·0=${${(M)${0::=${(%):-%x}}:#/*}:-$PWD/$0}
Notice: running check: CHECK_ZERO_ASSIGNMENT_STD…
[ZSweep][zscan:125]: Warning: $0 setting isn't the standard one, it's best if it's:
·0=${${(M)${0::=${(%):-%x}}:#/*}:-$PWD/$0}

It would be great if the project had wiki pages or readme sections or something corresponding to CHECK_ZERO_ASSIGNMENT and CHECK_ZERO_ASSIGNMENT_STD, where a user can learn more about the what and why of those warnings and suggested solutions.

Then there are a bunch of lines like:

[ZSweep][zsfilt:184]: Error: near line #2399 ↔  words=(pip-compile $words):
but it doesn't identify the error by a code or name or description, so I can't tell what's wrong.

EDIT:

Then there are some warnings like:

[ZSweep][zscan:125]: Warning: Incorrect array append, it should say: arr+=(elem) not: arr+=elem which doesn't work on various occasions.

and

[ZSweep][zscan:125]: Warning: A global variable has been created without declaration, by assignment. Add a line like local VAR or typeset -g VAR so that the variable is defined before use.

but they don't seem to indicate where in my source these issues are encountered.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.