Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_Related Related Topics sp_TopicIcon
small improvements of the jqGrid code with respect of ReSharper 6
Tags: ReSharper
28/07/2011
01:33
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

The new version of ReSharper (http://www.jetbrains.com/resharper/) gives many hints which halps to improve a litle JavaScript code of jqGrid. If you have an interest I could post you the recomendations one after another or you can buy the tool yourself.

Here is example of recommendation about grid.grouping.js:

1) the line 77 is

$.each(grp.summaryval[0][itm],function(i,n) {

which can be reduced to

$.each(grp.summaryval[0][itm],function() {

because i and n parameters will be never used.

2) In the line 100 the variable collapsed are initialized to false, so the line 130 with the same assignment can be removed.

3) In the line 141 the variable pmrtl will be initialized to "", but the value will be never used. Instead of that in the lines 153-154 the variable pmrtl will be set to grp.plusicon or grp.minusicon depend on grp.groupCollapse. One can for example remove the lines 153-154 and replace in the line 141 (initialization of pmrtl)

pmrtl = ""

 to

pmrtl = grp.groupCollapse? grp.plusicon: grp.minusicon

4) The last parameter current of the function groupingGroupBy defined in the line 217 can be removed, because it will be never used inside.

5) Variable i will be defined in the  function groupingGroupBy twice (in the line 226 and the line 232). Die suggestion is to insert the declaration of i in the line 219 or 223 (which can be concatinated by the way) and renove "var " from the lines 226 and 232.

It is an example of advices which gives ReSharper. If you have an interest to make the corresponding changes in the jqGrid I could post you one after another advices to all other jqGrid modules.

Best regards
Oleg 

28/07/2011
12:41
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Thanks Oleg,

I will check these at end of week. Will let you know

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

06/08/2011
18:34
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

It's just an reminder. You promissed to read my suggestions. ReSharper could help to remove unused parameters used in callback functions in defferent places of jqGrid. It point additionally to some places where uninitialized variables could be used. All this is not clitical, but can improve the code.

Please read another bug report too which I resently posted.

Best regards
Oleg

14/08/2011
11:30
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello Oleg,

Just do these fixes in GitHub. Thanks again. Going to look at the others.

Kind Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

15/01/2012
23:22
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

Hello Tony,

I use ReSharper 6.1 for my projects and find it's suggestions very clear. It can help in one click to fix the problem. If I open the current code of jqGrid I can see many small problems identivied by ReSharper. It's mostly the following:

  • declared, but not used parameters in the function. It's very common problem in the usage of $.each or in the event handlers. For example, the line
  • value assigned, but not used in any execution path. For example the line.
  • declaration of variable in the function with the same name as in the outer scope. For example, declaration i variable which can be easy renamed in j or k to fix the problem.
  • the usage of variables which start with capical character, undescore (_) or the usage of undescore inside of the name.
  • usage of possibly unassigned value.
  • ...

Description of all the small problems which are not really errors can get many time, but I could make the most clear and transparent changes (for example the first and the second problems from the list above) for beginning and post the results as a pull request. What do you think about?

Best regards
Oleg 

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
56 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information