Giter Club home page Giter Club logo

codeinspector's People

Contributors

fjra avatar ljdandria avatar timotheev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codeinspector's Issues

Why are sessionSymbols considered suspicious?

I recently noticed that codeInspector gave warnings about Quit, Echo and other so-called SessionSymbols here. I wonder what those warnings are about? One thing that I can think of is that these symbols are often for debugging during development, so the warning is there to remind users that there are debug symbols and should not be included in the final package?

Generalize OptionsPattern inspection

The following reports a potential problem as expected:

CodeInspectSummarize[
 "f[x_ : {}, OptionsPattern[]] := x"
 ]

image

This one should too:

CodeInspectSummarize[
 "f[x_List : {}, OptionsPattern[]] := x"
 ]

Currently, it does not report anything.

List is not sufficiently specific and the same issues apply as with a naked _. OptionsPattern[] will eat Lists.

To be clear, I am not asking for handling all cases that are not sufficiently specific. That is both unreasonable and impossible. I am asking just for _List, which should cover a significant fraction of cases that remain after having dealt with a naked _.

Avoid scanBadSymbols to be Error.

Sometimes users may define their own functions using the same name in the following list:

(*
Scan some symbols that are intuitive, yet do not exist
*)
LeafNode[Symbol,
"AnyFalse" | "AllFalse" | "Failed" | "Boolean" | "RealQ" | "FalseQ" | "RationalQ" |
"ComplexQ" | "SymbolQ" | "Match" | "UnSameQ" | "StringMatch", _] -> scanBadSymbols,

I don't think it is necessary to raise them as errors. Maybe a hint?

CodeInspectBoxSummarize[File["path"]] causes errors

Since there is no usage message for CodeInspectBoxSummarize is it meant to be a public symbol?

Because it is on the context path, it shows on autocompletion for CodeInspectSummarize which is what I intended to enter when I entered...

CodeInspectBoxSummarize[File["path"]]  

resulting in errors:

Do::iterb: Iterator {CodeInspector`Boxes`Private`lint,CodeInspector`Boxes`Private`lints$185609} does not have appropriate bounds.

Join::heads: Heads List and CodeParser`CodeConcreteParseBox at positions 1 and 2 are expected to be the same.

CodeInspect does not know about ApplyTo sugar

ApplyTo is new in 12.2. CodeInspect (and co) flags it as problematic:

In[1]:= Needs["CodeInspector`"]

In[2]:= CodeInspect["f=1;f//=Sin"]

Out[2]= {
CodeInspector`InspectionObject[
 "ExpectedOperand", "Expected an operand.", "Fatal", 
Association[
  CodeParser`Source -> {{1, 8}, {1, 8}}, ConfidenceLevel -> 1.]]}

Environment info:

In[3]:= $Version
Out[3]= "12.2.0 for Mac OS X x86 (64-bit) (December 3, 2020)"

In[4]:= PacletObject["CodeInspector"]["Version"]
Out[4]= "1.1.1"

Error Get::noopen: Cannot open CodeFormatter`.

I think the line PacletInstall["CodeFormatter"] should be added to the installation instructions for versions below 12.2 (I have 12.1 myself), where it says to install with PacletInstall["CodeParser"] PacletInstall["CodeInspector"]. Otherwise I get the error Error Get::noopen: Cannot open CodeFormatter.`

Some important CodeInspect hints do not get shown (too low confidence?)

The code error Which[a, b, a, c] gets picked up by the plugin, but a related one like Which[a, b, c] does not. Presumably this is because CodeInspect assigns a relatively low confidence (0.55) to this case?

CodeInspect["Which[a, b, a, c]"]
CodeInspect["Which[a, b, c]"]

This is rather unfortunate, since this is a pretty important and common error to catch. I don't know what the proper solution is, but I feel like this is worth addressing.

Warnings about letterlike characters in identifiers

Hi, I wonder if there's a valid range for unicode characters that can appear in identifiers? Currently, Cyrillic letters, CJK characters, and other letterlike characters (like emoji ๐Ÿ˜‚) will generate the [UnexpectedLetterlikeCharacter] Unexpected letterlike character: \:xxxx warning., e.g.

In[] := CodeInspect["\\:0438=1"]

Out[] := {
CodeInspector`InspectionObject[
 "UnexpectedLetterlikeCharacter", 
  "Unexpected letterlike character: ``\\:0438``.", "Warning", 
Association[
  CodeParser`Source -> {{1, 1}, {1, 7}}, ConfidenceLevel -> 0.8]]}

Publish 1.2 to paclet server

The current version (1.2) seems only available on MMA 12.3. Do we have the plan to upload it to the official paclet server for earlier versions?

Resolution of Language specific messages

The following MWE shows that CodeInspector does not recognize the language tag in message names.

In[1]:= Needs["CodeParser`"]

In[2]:= Needs["CodeInspector`"]

In[3]:= CodeInspect["symbol::usage=\"symbol usage message.\""]

Out[3]= {}

In[4]:= CodeInspect["symbol::usage::English=\"symbol usage message in English.\""]

Out[4]= {MessageName Error Unexpected argument to MessageName.}

In[5]:= CodeInspect["symbol::usage::French=\"message d'utilisation du symbole en francais.\""]
                     
Out[5]= {MessageName Error Unexpected argument to MessageName.}

Add textual output support for CLI usage

I'm writing WL in Vim and using wolframscript and would love to be able to have my files checked on save (or even integrate it with tools like ALE). Would it be possible to get the summary of issues in some human readable form?

I tried Print[CodeInspectSummarize[File["match_distribution.wl"]]] and now have permanent eye damage ;) :D

But seriously, this is a very cool tool! Keep up the good work!

"Duplicate keys in list of rules." in the presence of conditions

Hi! The following code snippet

CodeInspectSummarize[
  "{foo[a_,b_]:>bar1[a,b]/;a=!=b, foo[a_,b_]:>bar2[a,b]/;a===b}"]

triggers a warning, yet the code works as expected.

Of course one could debate whether the conditionals should be always put before :>
or not, but I'm curious if the given example really should be considered problematic
from the technical point of view.

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.