Moodle Coding style

Moodle Coding style

by Fabienne Neveu -
Number of replies: 3

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: -
In reply to Fabienne Neveu

Re: Moodle Coding style

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin 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)
In reply to Fabienne Neveu

Re: Moodle Coding style

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

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)
In reply to AL Rachels

Re: Moodle Coding style

by Fabienne Neveu -

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