0 or 0px

0 or 0px

by Gareth J Barnard -
Number of replies: 13
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hello Themers,

I've just updated my M3.1 and noticed that MDL-54559 changes a margin in the modules.less file to '0px'.  I thought (with Codechecker etc.) that it was now good practice to have just '0'.  I realise that past code should not be changed, but when changes are made now then that should be the best practice.

Thoughts please before I raise a policy tracker issue.

Cheers,

Gareth

Average of ratings: Useful (1)
In reply to Gareth J Barnard

Re: 0 or 0px

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

IT just goes to show what mistakes are added to Moodle by thoses who. We think to be more knowledgable than ourselves.

I saw that and thought to open a new tracker issue, but then realised that there are others in both Bootstrap and other parts of Bootstrapbase code itself. 

Technically though 0px is wrong so tracker issue sounds like a good idea.

Cheers

Mary

Average of ratings: Useful (2)
In reply to Gareth J Barnard

Re: 0 or 0px

by Fernando Acedo -
Picture of Plugin developers Picture of Testers

Just a silly question. Why should we vote to fix an issue that is obvious?

It is not an improvement. It is a wrong coding. If codechecker verify even indentation then 0px is also an error.

Ok, it is not serious. Could we live 10 years (like many other issues) with it but why to vote if it something  obvious?

Just run CSSlint


In reply to Fernando Acedo

Re: 0 or 0px

by Mary Evans -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

We have to vote because that is the policy. It is not a bug as it does not breal anything so it is an Improvement.

Improvements need Votes

In reply to Fernando Acedo

Re: 0 or 0px

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

If you really want to get something fixed, then you can add a patch to the tracker issue (if you know now), instead of adding a vote. Much more effective!

In reply to Tim Hunt

Re: 0 or 0px

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Tim,

That doesn't work either: MDL-50660 -> MDL-50669.

Is there another way to get a decision made and progress achieved?

Cheers,

Gareth

In reply to Gareth J Barnard

Re: 0 or 0px

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

True, some issues are messy, with no single clear solution. Then fixing it involves choosing which compromise is least bad and that can take a lot of discussion first.

However, such issues are rare. Many issues have a clear-cut fix or improvement. Getting those integrated is quite easy once the patch is created. (In my experience.)

In reply to Tim Hunt

Re: 0 or 0px

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Tim,

Thank you for your reply.

Perhaps what I don't understand is that they are both easy decisions to make policy wise.  Very clear cut:

  1. All new / changed CSS shall use '0' with no units.
  2. Old specific browser selectors below the recommended version shall be removed to reduce clutter and bandwidth.

I'm not sure really what is unclear about that.  The first is easy as its implementing best practice.  The second is a decision to take the rubbish out.

Cheers,

Gareth

In reply to Gareth J Barnard

Re: 0 or 0px

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I would say that 1) is uncontroversial, but not a big deal, and 2) is not entirely clear cut. There is a very small chance of doing harm there. Neither are the most important open bug in Moodle.
In reply to Tim Hunt

Re: 0 or 0px

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

True Tim, but... removing rubbish helps to reduce the amount of things that could go wrong.  I'm not saying that what is there for older browsers is wrong, just that the more that is redundant the more there is to cause unexpected grief.

In reply to Gareth J Barnard

Re: 0 or 0px

by David Scotson -
The last time I tried to get CSS linting happening in core, I was told that Moodle does not have any CSS coding guidelines.

The ones you might find on the wiki are apparently just somebodies suggestions, and the Moodle core dev team have never committed to following them.

This seems inconsistent to me, since they have solid guidelines for PHP (that even go so far as to complain about the punctuation in PHP comments!) and they've just adopted a very in-depth JS linting strategy, with plans to expand it further.

Meanwhile on the CSS side the automation stops at running csslint with this very minimal config:

--errors=errors,duplicate-properties
--warnings=known-properties,display-property-grouping,empty-rules,important

csslint itself is a bit old and outdated, and there's more modern options, I like:

https://github.com/stylelint/stylelint