[Wikitech-l] MediaWiki-Codesniffer 0.9.0 released

2017-06-19 Thread Legoktm
Hi!

MediaWiki-CodeSniffer 0.9.0 is now available for use in your MediaWiki
extensions and other projects. Here are the notable changes since the
last release:

* Add sniff to enforce "function (" for closures (Kunal Mehta)
* Add usage of && in generic_pass (addshore)
* Disallow `and` and `or` (Kunal Mehta)
* Don't require documentation for constructors without parameters (Kunal
Mehta)
* Don't require documentation for '__toString' (Kunal Mehta)
* Don't require return/throws/param for doc blocks with @inheritDoc
(Kunal Mehta)
* Expand list of standard methods that don't need documentation (Kunal
Mehta)
* Fix FunctionComment.Missing sniff code (Kunal Mehta)
* Fix indentation (Umherirrender)
* Fix WhiteSpace/SpaceAfterClosureSniff (Antoine Musso)
* Make sure all files end with a newline (Kunal Mehta)
* test: ensure consistent report width (Antoine Musso)
* Update for CodeSniffer 3.0 (Kunal Mehta)
* Update squizlabs/PHP_CodeSniffer to 3.0.1 (Reedy)
* Use upstream CharacterBeforePHPOpeningTag sniff (Kunal Mehta)

The 3.0 upstream release should bring in a lot of under-the-hood
improvements, including support for parallel processing!

Note that due to an upstream bug, PHPCS 3.x doesn't work with repos that
have "prepend-autoloader": false set.

I've begun to submit patches to upgrade to the latest version and
automatically fix some of the issues:
.

Thanks to everyone who contributed to this release, please file bugs or
feature requests in the MediaWiki-Codesniffer Phabricator project if you
find any.

-- Legoktm

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] "Unloading"/reloading ResourceLoader modules the proper way?

2017-06-19 Thread Jack Phoenix
Thanks for the replies, everyone.

On Mon, Jun 19, 2017 at 8:42 PM, Bartosz Dziewoński  wrote:
> I don't think "unloading" modules will ever be a thing. While
> ResourceLoader could be made to keep track of modules' CSS to be able to
> remove it, we can't "unload" JavaScript modules at all (because their code
> has already executed), so I'm not sure if we'd want to add such special
> case.
I still think it'd make sense to have some sort of official support
for unloading modules' CSS, whether we're talking about CSS-only
modules or modules which happen to also include CSS. CSS and JS
obviously have different functions, and just like how you use
$out->addModules( 'some-module-name' ); to load JS modules and
$out->addModuleStyles( 'some-module-name' ); to load CSS modules in
PHP, why couldn't there be official support for unloading CSS modules?
Or failing that, support for a way to tell ResourceLoader, "yes, I
*really* want to reload this module again even if you think that it's
already loaded and thus there's no need to make another HTTP request".

> If you want a slightly less horrible hack than you do now – you could
> generate an appropriate load.php URL yourself (with =styles) and add
> that in a  tag to the page, much like we did back in the old days
> with importStylesheetURI(). ResourceLoader won't even know the module is
> loaded. And this way, you can remove the  tag later without messing
> with ResourceLoader's internals.
Thanks for the suggestion. While I didn't implement this at this time
-- simply because I managed to get my hacks working before you posted
this message -- I'm sure this is the route I'll have to take in the
future. For the time being, I solved the problem by using a cache
variable and caching loaded CSS there and instead of trying to
(unsuccessfully) call mw.loader.load() twice (or thrice etc.) I first
check cache and try to use the cached CSS if possible [1].

As always, code review of both the JS and PHP parts of the patchset
[2] is welcome, although the most acute problem (with the JS) is now
fixed and legoktm gave me a few good pointers on how to make the PHP
part saner. :-)

[1] https://gerrit.wikimedia.org/r/#/c/359643/6..7/ext.theme.livepreview.js
[2] https://gerrit.wikimedia.org/r/359643


Thanks and regards,
--
Jack Phoenix
MediaWiki developer

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] "Unloading"/reloading ResourceLoader modules the proper way?

2017-06-19 Thread Bartosz Dziewoński
I don't think "unloading" modules will ever be a thing. While
ResourceLoader could be made to keep track of modules' CSS to be able to
remove it, we can't "unload" JavaScript modules at all (because their code
has already executed), so I'm not sure if we'd want to add such special
case.

If you want a slightly less horrible hack than you do now – you could
generate an appropriate load.php URL yourself (with =styles) and add
that in a  tag to the page, much like we did back in the old days
with importStylesheetURI(). ResourceLoader won't even know the module is
loaded. And this way, you can remove the  tag later without messing
with ResourceLoader's internals.

-- 
Matma Rex
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] +2 request for Ladsgroup (Amir)

2017-06-19 Thread Daniel Kinzler
Excellent! Well earned!

Am 19.06.2017 um 10:32 schrieb Antoine Musso:
> On 13/06/2017 04:24, Legoktm wrote:
>> Hi,
>>
>> Ladsgroup filed a request[1] for +2 in mediawiki/* repos that I missed
>> until now, and hadn't been sent to this mailing list. Please comment if
>> you haven't already and I'll close it in a few days.
>>
>> [1] https://phabricator.wikimedia.org/T165860
>>
>> -- Legoktm
> 
> Hello,
> 
> Amir now has +2 rights in Gerrit for the mediawiki/* repositories.
> 
> 


-- 
Daniel Kinzler
Principal Platform Engineer

Wikimedia Deutschland
Gesellschaft zur Förderung Freien Wissens e.V.

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] "Unloading"/reloading ResourceLoader modules the proper way?

2017-06-19 Thread Brad Jorsch (Anomie)
On Mon, Jun 19, 2017 at 2:14 AM, Legoktm 
wrote:

> Hi,
>
> On 06/18/2017 01:00 PM, Jack Phoenix wrote:
> > What would be the proper way to signal to ResourceLoader, "actually I
> > need you to load this module again"?
>
> I don't think ResourceLoader was really designed for the concept of
> "unloading" modules. Instead I'd suggest scoping the CSS to some class
> like "theme-name" and then using JS to set and remove that class from
>  (or whatever other element) as needed.
>

I note VE has a similar bug in https://phabricator.wikimedia.org/T156414.
But I suspect that the part of that task relating to steps 8 and 9 is/will
be low priority.


-- 
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation
___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] +2 request for Ladsgroup (Amir)

2017-06-19 Thread Antoine Musso

On 13/06/2017 04:24, Legoktm wrote:

Hi,

Ladsgroup filed a request[1] for +2 in mediawiki/* repos that I missed
until now, and hadn't been sent to this mailing list. Please comment if
you haven't already and I'll close it in a few days.

[1] https://phabricator.wikimedia.org/T165860

-- Legoktm


Hello,

Amir now has +2 rights in Gerrit for the mediawiki/* repositories.


--
Antoine "hashar" Musso


___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Re: [Wikitech-l] "Unloading"/reloading ResourceLoader modules the proper way?

2017-06-19 Thread Legoktm
Hi,

On 06/18/2017 01:00 PM, Jack Phoenix wrote:
> What would be the proper way to signal to ResourceLoader, "actually I
> need you to load this module again"?

I don't think ResourceLoader was really designed for the concept of
"unloading" modules. Instead I'd suggest scoping the CSS to some class
like "theme-name" and then using JS to set and remove that class from
 (or whatever other element) as needed.

-- Legoktm

___
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l