Re: [Pharo-dev] some little static analysis with great impact
I'm always applying the autoformatting before I save the method, which helps me a lot in detecting those problems, because I immediately see that the code is formatted strangely. But of course analysis would be nice for people that don't use autoformatting, or for better (and automated) detection. Peter On Thu, Nov 03, 2016 at 05:47:51PM +0100, stepharo wrote: > > > Le 3/11/16 à 15:52, Esteban Lorenzano a écrit : > >wouldn’t this be better to solve this with QA? > but QA needs the analysis first. > > > >>On 3 Nov 2016, at 15:17, stepharowrote: > >> > >>Hi > >> > >>I often end up forgetting a period. > >> > >>printOn: aStream > >>super printOn: aStream. > >>aStream nextPutAll: ' "' > >>aStream nextPutAll: contents. > >>aStream nextPutAll: '" '. > >> > >> > >>And statically the system could see it with a simple heuristics: > >> > >>if the message as the same name as self, super, a tmp or an argument > >> > >>May be there is a missing period. > >> > >>Could the compiler get this analysis? > >> > >>Stef > >> > >> > > > > > >
Re: [Pharo-dev] some little static analysis with great impact
2016-11-03 22:05 GMT+01:00 Nicolas Cellier < nicolas.cellier.aka.n...@gmail.com>: > Hi Uko, > I often write things like > | abs | > abs := self abs. > so I would not like the temp/args rule... > But for args it could be not bad
Re: [Pharo-dev] some little static analysis with great impact
2016-11-03 23:39 GMT+01:00 Yuriy Tymchuk: > On 3 Nov 2016, at 22:05, Nicolas Cellier gmail.com> wrote: > > Can we have rules about indentation? > > > Yes, we can. I think that even easier heuristic would be to check if a > unary is separated from the receiver by a line break. > +1, I guess such formatting is pretty unusual indeed...
Re: [Pharo-dev] some little static analysis with great impact
> On 3 Nov 2016, at 22:05, Nicolas Cellier> wrote: > > Can we have rules about indentation? Yes, we can. I think that even easier heuristic would be to check if a unary is separated from the receiver by a line break.
Re: [Pharo-dev] some little static analysis with great impact
2016-11-03 21:53 GMT+01:00 Yuriy Tymchuk: > There is already RBUncommonMessageSendRule which checks for #(#self #super > #thisContext #true #false #nil). I could also extend it to temps and args. > > Uko > Hi Uko, I often write things like | abs | abs := self abs. so I would not like the temp/args rule... What make it obvious to our eyes is indentation in this case. >From compiler POV it's just a yet unimplemented message. Can we have rules about indentation? > > > On 3 Nov 2016, at 15:17, stepharo wrote: > > > > Hi > > > > I often end up forgetting a period. > > > > printOn: aStream > >super printOn: aStream. > >aStream nextPutAll: ' "' > >aStream nextPutAll: contents. > >aStream nextPutAll: '" '. > > > > > > And statically the system could see it with a simple heuristics: > > > >if the message as the same name as self, super, a tmp or an argument > > > > May be there is a missing period. > > > > Could the compiler get this analysis? > > > > Stef > > > > > > >
Re: [Pharo-dev] some little static analysis with great impact
There is already RBUncommonMessageSendRule which checks for #(#self #super #thisContext #true #false #nil). I could also extend it to temps and args. Uko > On 3 Nov 2016, at 15:17, stepharowrote: > > Hi > > I often end up forgetting a period. > > printOn: aStream >super printOn: aStream. >aStream nextPutAll: ' "' >aStream nextPutAll: contents. >aStream nextPutAll: '" '. > > > And statically the system could see it with a simple heuristics: > >if the message as the same name as self, super, a tmp or an argument > > May be there is a missing period. > > Could the compiler get this analysis? > > Stef > >
Re: [Pharo-dev] some little static analysis with great impact
Le 3/11/16 à 15:52, Esteban Lorenzano a écrit : wouldn’t this be better to solve this with QA? but QA needs the analysis first. On 3 Nov 2016, at 15:17, stepharowrote: Hi I often end up forgetting a period. printOn: aStream super printOn: aStream. aStream nextPutAll: ' "' aStream nextPutAll: contents. aStream nextPutAll: '" '. And statically the system could see it with a simple heuristics: if the message as the same name as self, super, a tmp or an argument May be there is a missing period. Could the compiler get this analysis? Stef
Re: [Pharo-dev] some little static analysis with great impact
2016-11-03 15:17 GMT+01:00 stepharo: > Hi > > I often end up forgetting a period. > > printOn: aStream > super printOn: aStream. > aStream nextPutAll: ' "' > aStream nextPutAll: contents. > aStream nextPutAll: '" '. > > > And statically the system could see it with a simple heuristics: > > if the message as the same name as self, super, a tmp or an argument > > May be there is a missing period. > > Could the compiler get this analysis? > > Stef > > > The highlighter gives some hints ( as in this example, message nextPutAll:nextPutAll: isn't known). And we have the RBUncommonMessageSendRule, but this rule only checks for messagenames like "self" or "true". It does not check the variables or argument names.
Re: [Pharo-dev] some little static analysis with great impact
wouldn’t this be better to solve this with QA? > On 3 Nov 2016, at 15:17, stepharowrote: > > Hi > > I often end up forgetting a period. > > printOn: aStream >super printOn: aStream. >aStream nextPutAll: ' "' >aStream nextPutAll: contents. >aStream nextPutAll: '" '. > > > And statically the system could see it with a simple heuristics: > >if the message as the same name as self, super, a tmp or an argument > > May be there is a missing period. > > Could the compiler get this analysis? > > Stef > >
[Pharo-dev] some little static analysis with great impact
Hi I often end up forgetting a period. printOn: aStream super printOn: aStream. aStream nextPutAll: ' "' aStream nextPutAll: contents. aStream nextPutAll: '" '. And statically the system could see it with a simple heuristics: if the message as the same name as self, super, a tmp or an argument May be there is a missing period. Could the compiler get this analysis? Stef