General developer forum

Moodle Coding style

 
Picture of Fabienne Neveu
Moodle Coding style
 

Hi there,

for our Moodle  - web presence we developed some plugins. Now I want to make the code comply with the Moodle-Coding styles. Because I work with PHP Storm, I downloaded an XML-File that contains Moodle Codingstyles and applied to the code. Non-the-less there are still many (> 1000) errors like e.g. comment conventions such as

" of the opening comment must start "// "


Can you recommend a way in order to get rid of the 1000 of errors and warnings displayed by the code checker ? Other Moodle.xml ?


Thanks!


Best,


Fabienne



 
Average of ratings: -
Picture of Iñaki Arenaza
Re: Moodle Coding style
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Errrrmmmm, if you " want to make the code comply with the Moodle-Coding styles" and the XML file you downloaded is saying that you still have errors of that kind, the only way I see to comply with the codying style is, you know, fixing them wink

If you want to mostly-comply, or somewhat-comply with the coding style, ignoring particular kinds of conventions, you'll need to edit the XML file with the coding style definitions and remove the ones you don't want to comply with.

Saludos.

Iñaki.

 
Average of ratings: Useful (1)
Picture of AL Rachels
Re: Moodle Coding style
Core developersParticularly helpful MoodlersPlugin developersTesters

Hi Fabienne,

When I took over support for a couple of plugins, I was in the same boat with thousands of code style and documentation errors. I automated fixing as much of it as I could by using the replace capability of Notepad++. When I could create a very definitive search, I turned it loose with auto replace. If I could not be absolutely definitive as to what to search for, I  let it find the next and if needed, then hit the replace button and repaired them one at a time.

I also resigned myself to the fact that it was going to take a while, no matter what, so I worked an hour or two each day until I was mostly finished about a week later.

 
Average of ratings: Useful (1)
Picture of Fabienne Neveu
Re: Moodle Coding style
 

Hi,

... thank you all!

the comment conventions are no longer a prob.

It is way more harder to remove all the naming probs, like

e.g. eliminating the underscores in variable names or Capitals

in class names. 

Is there really no XML-template for that in order to let PHP Storm do that ?


Thanks  and have a nice weekend...


Best,

Fabienne





 
Average of ratings: -