diff --git a/.arclint b/.arclint
index 438101ed..816de021 100644
--- a/.arclint
+++ b/.arclint
@@ -1,72 +1,59 @@
{
"exclude": [
- "(^externals/)",
- "(\\.lint-test$)"
+ "(^externals/)"
],
"linters": {
"chmod": {
"type": "chmod"
},
"filename": {
"type": "filename"
},
"generated": {
"type": "generated"
},
"json": {
"type": "json",
"include": [
"(^resources/arclint/.*\\.arclint\\.example$)",
"(^\\.arcconfig$)",
"(^\\.arclint$)",
"(\\.json$)"
]
},
"merge-conflict": {
"type": "merge-conflict"
},
"nolint": {
"type": "nolint"
},
"phutil-library": {
"type": "phutil-library",
"include": "(\\.php$)"
},
"phutil-xhpast": {
"type": "phutil-xhpast",
"include": "(\\.php$)"
},
"spelling": {
"type": "spelling",
"exclude": "(^resources/spelling/.*\\.json$)"
},
"text": {
- "type": "text",
- "exclude": [
- "(^\\.arclint$)"
- ]
- },
- "text-without-length": {
- "type": "text",
- "severity": {
- "3": "disabled"
- },
- "include": [
- "(^\\.arclint$)"
- ]
+ "type": "text"
},
"xhpast": {
"type": "xhpast",
"include": "(\\.php$)",
"severity": {
"16": "advice",
"34": "error"
},
"xhpast.blacklisted.function": {
"eval": "The eval() function should be avoided. It is potentially unsafe and makes debugging more difficult."
},
"xhpast.php-version": "5.2.3",
"xhpast.php-version.windows": "5.3.0"
}
}
}
diff --git a/.editorconfig b/.editorconfig
index cbf4b57a..0b1c0e67 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -1,27 +1,53 @@
; http://editorconfig.org/
[*]
indent_style = space
indent_size = 2
+end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
+max_line_length = 80
+
+[src/lint/linter/__tests__/**.lint-test]
+indent_style =
+end_of_line =
+max_line_length =
+trim_trailing_whitespace =
[src/parser/__tests__/bundle/*]
-trim_trailing_whitespace = false
insert_final_newline = false
-[src/parser/__tests__/diff/*.{git,hg,svn,u}diff]
+[src/parser/__tests__/diff/*.{git,hg,rcs,svn,u}diff]
+indent_style =
trim_trailing_whitespace = false
insert_final_newline = false
+max_line_length =
+
+[src/parser/__tests__/patches/*.{git,hg,rcs,svn,u}patch]
+indent_style =
+trim_trailing_whitespace = false
+max_line_length =
[src/parser/__tests__/patches/*.gitpatch]
+end_of_line =
+
+[src/parser/__tests__/**/*.txt]
+max_line_length =
+
+[src/repository/parser/__tests__/mercurial/*.txt]
trim_trailing_whitespace = false
insert_final_newline = false
+max_line_length =
+
+[src/unit/parser/__tests__/testresults/go.*]
+indent_style =
+
+[src/unit/parser/__tests__/testresults/xunit.*]
+max_line_length =
[externals/**]
-; Use editor default (possible autodetection).
indent_style =
indent_size =
trim_trailing_whitespace = false
insert_final_newline = false
diff --git a/LICENSE b/LICENSE
index f433b1a5..d9a10c0d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,177 +1,176 @@
-
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
diff --git a/scripts/breakout.py b/scripts/breakout.py
index 9cb2e561..4ee3af11 100755
--- a/scripts/breakout.py
+++ b/scripts/breakout.py
@@ -1,216 +1,220 @@
#!/usr/bin/env python
import sys
import time
import select
import curses
import curses.wrapper
entities = []
grid = []
class Wall:
def collide(self, ball):
return False
class Block:
killed = 0
total = 0
def __init__(self, x, y, w, h, c):
self.x = x
self.y = y
self.w = w
self.h = h
self.fmt = curses.A_BOLD | curses.color_pair(c)
self.alive = True
for i in range(self.x, self.x + self.w):
for j in range(self.y, self.y + self.h):
grid[j + 1][i + 1] = self
Block.total += 1
def collide(self, ball):
self.alive = False
for i in range(self.x, self.x + self.w):
for j in range(self.y, self.y + self.h):
grid[j + 1][i + 1] = None
Block.killed += 1
return False
def tick(self, win):
if self.alive:
for i in range(self.x, self.x + self.w):
for j in range(self.y, self.y + self.h):
win.addch(j, i, curses.ACS_BLOCK, self.fmt)
return self.alive
class Ball:
alive = False
killed = 0
def __init__(self, x, y, vx, vy):
self.x = x
self.y = y
self.vx = vx
self.vy = vy
Ball.alive = True
def collide(self, ball):
return True
def encounter(self, dx, dy):
ent = grid[self.y + dy + 1][self.x + dx + 1]
if ent and not ent.collide(self):
self.vx -= 2 * dx
self.vy -= 2 * dy
return ent
def tick(self, win):
while self.y < ship.y:
if self.encounter((self.vx + self.vy) / 2, (self.vy - self.vx) / 2):
continue
if self.encounter((self.vx - self.vy) / 2, (self.vy + self.vx) / 2):
continue
if self.encounter(self.vx, self.vy):
continue
break
self.x += self.vx
self.y += self.vy
try:
win.addch(self.y, self.x, 'O')
except curses.error:
Ball.alive = False
Ball.killed += 1
return Ball.alive
class Ship:
def __init__(self, x, y):
self.x = x
self.y = y
self.hw = 10
self.v = 4
self.last = 1
self.update()
def update(self):
grid[self.y + 1] = (
[ None ] * (self.x - self.hw + 1) +
[ self ] * (self.hw * 2 + 1) +
[ None ] * (width - self.x - self.hw)
)
def collide(self, ball):
ball.vy = -1
if ball.x > self.x + self.hw / 2:
ball.vx = 1
elif ball.x < self.x - self.hw / 2:
ball.vx = -1
return True
def shift(self, i):
self.last = i
self.x += self.v * i
if self.x - self.hw < 0:
self.x = self.hw
elif self.x + self.hw >= width:
self.x = width - self.hw - 1
self.update()
def spawn(self):
if not Ball.alive:
entities.append(Ball(self.x, self.y - 1, self.last, -1))
def tick(self, win):
if not Ball.alive:
win.addch(self.y - 1, self.x, 'O')
win.addch(self.y, self.x - self.hw, curses.ACS_LTEE)
for i in range(-self.hw + 1, self.hw):
win.addch(curses.ACS_HLINE)
win.addch(curses.ACS_RTEE)
return True
class PowerOverwhelmingException(Exception):
pass
def main(stdscr):
global height, width, ship
for i in range(1, 8):
curses.init_pair(i, i, 0)
curses.curs_set(0)
curses.raw()
height, width = stdscr.getmaxyx()
if height < 15 or width < 30:
raise PowerOverwhelmingException(
"Your computer is not powerful enough to run 'arc anoid'. "
"It must support at least 30 columns and 15 rows of next-gen "
"full-color 3D graphics.")
status = curses.newwin(1, width, 0, 0)
height -= 1
game = curses.newwin(height, width, 1, 0)
game.nodelay(1)
game.keypad(1)
grid[:] = [ [ None for x in range(width + 2) ] for y in range(height + 2) ]
wall = Wall()
for x in range(width + 2):
grid[0][x] = wall
for y in range(height + 2):
grid[y][0] = grid[y][-1] = wall
ship = Ship(width / 2, height - 5)
entities.append(ship)
colors = [ 1, 3, 2, 6, 4, 5 ]
h = height / 10
for x in range(1, width / 7 - 1):
for y in range(1, 7):
- entities.append(Block(x * 7, y * h + x / 2 % 2, 7, h, colors[y - 1]))
+ entities.append(Block(x * 7,
+ y * h + x / 2 % 2,
+ 7,
+ h,
+ colors[y - 1]))
while True:
while select.select([ sys.stdin ], [], [], 0)[0]:
key = game.getch()
if key == curses.KEY_LEFT or key == ord('a') or key == ord('A'):
ship.shift(-1)
elif key == curses.KEY_RIGHT or key == ord('d') or key == ord('D'):
ship.shift(1)
elif key == ord(' '):
ship.spawn()
elif key == 0x1b or key == 3 or key == ord('q') or key == ord('Q'):
return
game.resize(height, width)
game.erase()
entities[:] = [ ent for ent in entities if ent.tick(game) ]
status.hline(0, 0, curses.ACS_HLINE, width)
status.addch(0, 2, curses.ACS_RTEE)
status.addstr(' SCORE: ', curses.A_BOLD | curses.color_pair(4))
status.addstr('%s/%s ' % (Block.killed, Block.total), curses.A_BOLD)
status.addch(curses.ACS_VLINE)
status.addstr(' DEATHS: ', curses.A_BOLD | curses.color_pair(4))
status.addstr('%s ' % Ball.killed, curses.A_BOLD)
status.addch(curses.ACS_LTEE)
if Block.killed == Block.total:
message = ' A WINNER IS YOU!! '
i = int(time.time() / 0.8)
for x in range(width):
for y in range(6):
game.addch(height / 2 + y - 3 + (x / 8 + i) % 2, x,
curses.ACS_BLOCK,
curses.A_BOLD | curses.color_pair(colors[y]))
game.addstr(height / 2, (width - len(message)) / 2, message,
curses.A_BOLD | curses.color_pair(7))
game.refresh()
status.refresh()
time.sleep(0.05)
try:
curses.wrapper(main)
print ('You destroyed %s blocks out of %s with %s deaths.' %
(Block.killed, Block.total, Ball.killed))
except PowerOverwhelmingException as e:
print e
diff --git a/src/lint/linter/__tests__/gjslint/gjslint.lint-test b/src/lint/linter/__tests__/gjslint/gjslint.lint-test
index 64c5c331..e745f9c7 100644
--- a/src/lint/linter/__tests__/gjslint/gjslint.lint-test
+++ b/src/lint/linter/__tests__/gjslint/gjslint.lint-test
@@ -1,20 +1,20 @@
var x = 'some really really really really really really really long string';
var y = 'some really really really really really really really really really long string',
z = 14;
var obj = {name : 'vm'};
var x
var result = true
|| false;
/**
* @param x
* @return {string}
*/
function foo(x) {
return 'bar';
}
~~~~~~~~~~
error:2:
error:4:
error:5:
error:7:
-error:9:
\ No newline at end of file
+error:9:
diff --git a/src/lint/linter/__tests__/jshint/jshint.lint-test b/src/lint/linter/__tests__/jshint/jshint.lint-test
index 287f7e95..fa6d2249 100644
--- a/src/lint/linter/__tests__/jshint/jshint.lint-test
+++ b/src/lint/linter/__tests__/jshint/jshint.lint-test
@@ -1,11 +1,11 @@
function f() {
for (ii = 0; ii < 3; ii++) {
g()
}
}
{
~~~~~~~~~~
warning:3:8
-error:7:1
\ No newline at end of file
+error:7:1
diff --git a/src/lint/linter/__tests__/lessc/css.lint-test b/src/lint/linter/__tests__/lessc/css.lint-test
index cb0ceb10..59d5b282 100644
--- a/src/lint/linter/__tests__/lessc/css.lint-test
+++ b/src/lint/linter/__tests__/lessc/css.lint-test
@@ -1,109 +1,109 @@
@charset "utf-8";
div { color: black; }
div { width: 99%; }
* {
min-width: 45em;
}
h1, h2 > a > p, h3 {
color: none;
}
div.class {
color: blue;
}
div#id {
color: green;
}
.class#id {
color: purple;
}
.one.two.three {
color: grey;
}
@media print {
* {
font-size: 3em;
}
}
@media screen {
* {
font-size: 10px;
}
}
@font-face {
font-family: 'Garamond Pro';
}
a:hover, a:link {
color: #999;
}
p, p:first-child {
text-transform: none;
}
q:lang(no) {
quotes: none;
}
p + h1 {
font-size: +2.2em;
}
#shorthands {
border: 1px solid #000;
font: 12px/16px Arial;
font: 100%/16px Arial;
margin: 1px 0;
padding: 0 auto;
}
#more-shorthands {
margin: 0;
padding: 1px 0 2px 0;
font: normal small/20px 'Trebuchet MS', Verdana, sans-serif;
font: 0/0 a;
border-radius: 5px / 10px;
}
.misc {
-moz-border-radius: 2px;
display: -moz-inline-stack;
width: .1em;
background-color: #009998;
background: -webkit-gradient(linear, left top, left bottom, from(red), to(blue));
margin: ;
.nested-multiple {
- multiple-semi-colons: yes;;;;;;
+ multiple-semi-colons: yes;;;;;;
};
filter: alpha(opacity=100);
width: auto\9;
}
#important {
color: red !important;
width: 100%!important;
height: 20px ! important;
}
.def-font(@name) {
@font-face {
font-family: @name
}
}
.def-font(font-a);
.def-font(font-b);
.æøå {
margin: 0;
}
~~~~~~~~~~
diff --git a/src/lint/linter/__tests__/lessc/extract-and-length.lint-test b/src/lint/linter/__tests__/lessc/extract-and-length.lint-test
index dcb8352d..ac616f79 100644
--- a/src/lint/linter/__tests__/lessc/extract-and-length.lint-test
+++ b/src/lint/linter/__tests__/lessc/extract-and-length.lint-test
@@ -1,134 +1,133 @@
-
// simple array/list:
.multiunit {
@v: abc "abc" 1 1px 1% #123;
length: length(@v);
extract: extract(@v, 1) extract(@v, 2) extract(@v, 3) extract(@v, 4) extract(@v, 5) extract(@v, 6);
}
.incorrect-index {
@v1: a b c;
@v2: a, b, c;
v1: extract(@v1, 5);
v2: extract(@v2, -2);
}
.scalar {
@var: variable;
var-value: extract(@var, 1);
var-length: length(@var);
ill-index: extract(@var, 2);
name-value: extract(name, 1);
string-value: extract("string", 1);
number-value: extract(12345678, 1);
color-value: extract(blue, 1);
rgba-value: extract(rgba(80, 160, 240, 0.67), 1);
empty-value: extract(~'', 1);
name-length: length(name);
string-length: length("string");
number-length: length(12345678);
color-length: length(blue);
rgba-length: length(rgba(80, 160, 240, 0.67));
empty-length: length(~'');
}
.mixin-arguments {
.mixin-args(a b c d);
.mixin-args(a, b, c, d);
.mixin-args(1; 2; 3; 4);
}
.mixin-args(@value) {
&-1 {
length: length(@value);
extract: extract(@value, 3) ~"|" extract(@value, 2) ~"|" extract(@value, 1);
}
}
.mixin-args(...) {
&-2 {
length: length(@arguments);
extract: extract(@arguments, 3) ~"|" extract(@arguments, 2) ~"|" extract(@arguments, 1);
}
}
.mixin-args(@values...) {
&-3 {
length: length(@values);
extract: extract(@values, 3) ~"|" extract(@values, 2) ~"|" extract(@values, 1);
}
}
.mixin-args(@head, @tail...) {
&-4 {
length: length(@tail);
extract: extract(@tail, 2) ~"|" extract(@tail, 1);
}
}
// "multidimensional" array/list
.md-space-comma {
@v: a b c, 1 2 3, "x" "y" "z";
length-1: length(@v);
extract-1: extract(@v, 2);
length-2: length(extract(@v, 2));
extract-2: extract(extract(@v, 2), 2);
&-as-args {.mixin-args(a b c, 1 2 3, "x" "y" "z")}
}
.md-cat-space-comma {
@a: a b c;
@b: 1 2 3;
@c: "x" "y" "z";
@v: @a, @b, @c;
length-1: length(@v);
extract-1: extract(@v, 2);
length-2: length(extract(@v, 2));
extract-2: extract(extract(@v, 2), 2);
&-as-args {.mixin-args(@a, @b, @c)}
}
.md-cat-comma-space {
@a: a, b, c;
@b: 1, 2, 3;
@c: "x", "y", "z";
@v: @a @b @c;
length-1: length(@v);
extract-1: extract(@v, 2);
length-2: length(extract(@v, 2));
extract-2: extract(extract(@v, 2), 2);
&-as-args {.mixin-args(@a @b @c)}
}
.md-3D {
@a: a b c d, 1 2 3 4;
@b: 5 6 7 8, e f g h;
.3D(@a, @b);
.3D(...) {
@v1: @arguments;
length-1: length(@v1);
extract-1: extract(@v1, 1);
@v2: extract(@v1, 2);
length-2: length(@v2);
extract-2: extract(@v2, 1);
@v3: extract(@v2, 1);
length-3: length(@v3);
extract-3: extract(@v3, 3);
@v4: extract(@v3, 4);
length-4: length(@v4);
extract-4: extract(@v4, 1);
}
}
~~~~~~~~~~
diff --git a/src/lint/linter/__tests__/lessc/functions.lint-test b/src/lint/linter/__tests__/lessc/functions.lint-test
index a1852af9..99d2260e 100644
--- a/src/lint/linter/__tests__/lessc/functions.lint-test
+++ b/src/lint/linter/__tests__/lessc/functions.lint-test
@@ -1,169 +1,169 @@
#functions {
@var: 10;
@colors: #000, #fff;
color: _color("evil red"); // #660000
width: increment(15);
height: undefined("self");
border-width: add(2, 3);
variable: increment(@var);
background: linear-gradient(@colors);
}
#built-in {
@r: 32;
escaped: e("-Some::weird(#thing, y)");
lighten: lighten(#ff0000, 40%);
darken: darken(#ff0000, 40%);
saturate: saturate(#29332f, 20%);
desaturate: desaturate(#203c31, 20%);
greyscale: greyscale(#203c31);
hsl-clamp: hsl(380, 150%, 150%);
spin-p: spin(hsl(340, 50%, 50%), 40);
spin-n: spin(hsl(30, 50%, 50%), -40);
luma-white: luma(#fff);
luma-black: luma(#000);
luma-black-alpha: luma(rgba(0,0,0,0.5));
luma-red: luma(#ff0000);
luma-green: luma(#00ff00);
luma-blue: luma(#0000ff);
luma-yellow: luma(#ffff00);
luma-cyan: luma(#00ffff);
luma-white-alpha: luma(rgba(255,255,255,0.5));
contrast-filter: contrast(30%);
saturate-filter: saturate(5%);
contrast-white: contrast(#fff);
contrast-black: contrast(#000);
contrast-red: contrast(#ff0000);
contrast-green: contrast(#00ff00);
contrast-blue: contrast(#0000ff);
contrast-yellow: contrast(#ffff00);
contrast-cyan: contrast(#00ffff);
contrast-light: contrast(#fff, #111111, #eeeeee);
contrast-dark: contrast(#000, #111111, #eeeeee);
contrast-wrongorder: contrast(#fff, #eeeeee, #111111, 0.5);
contrast-light-thresh: contrast(#fff, #111111, #eeeeee, 0.5);
contrast-dark-thresh: contrast(#000, #111111, #eeeeee, 0.5);
contrast-high-thresh: contrast(#555, #111111, #eeeeee, 0.6);
contrast-low-thresh: contrast(#555, #111111, #eeeeee, 0.1);
contrast-light-thresh-per: contrast(#fff, #111111, #eeeeee, 50%);
contrast-dark-thresh-per: contrast(#000, #111111, #eeeeee, 50%);
contrast-high-thresh-per: contrast(#555, #111111, #eeeeee, 60%);
contrast-low-thresh-per: contrast(#555, #111111, #eeeeee, 10%);
replace: replace("Hello, Mars.", "Mars\.", "World!");
replace-captured: replace("This is a string.", "(string)\.$", "new $1.");
replace-with-flags: replace("One + one = 4", "one", "2", "gi");
replace-single-quoted: replace('foo-1', "1", "2");
replace-escaped-string: replace(~"bar-1", "1", "2");
replace-keyword: replace(baz-1, "1", "2");
format: %("rgb(%d, %d, %d)", @r, 128, 64);
format-string: %("hello %s", "world");
format-multiple: %("hello %s %d", "earth", 2);
format-url-encode: %("red is %A", #ff0000);
format-single-quoted: %('hello %s', "single world");
format-escaped-string: %(~"hello %s", "escaped world");
eformat: e(%("rgb(%d, %d, %d)", @r, 128, 64));
-
+
unitless: unit(12px);
unit: unit((13px + 1px), em);
unitpercentage: unit(100, %);
-
+
get-unit: get-unit(10px);
get-unit-empty: get-unit(10);
hue: hue(hsl(98, 12%, 95%));
saturation: saturation(hsl(98, 12%, 95%));
lightness: lightness(hsl(98, 12%, 95%));
hsvhue: hsvhue(hsv(98, 12%, 95%));
hsvsaturation: hsvsaturation(hsv(98, 12%, 95%));
hsvvalue: hsvvalue(hsv(98, 12%, 95%));
red: red(#f00);
green: green(#0f0);
blue: blue(#00f);
rounded: round((@r/3));
rounded-two: round((@r/3), 2);
roundedpx: round((10px / 3));
roundedpx-three: round((10px / 3), 3);
rounded-percentage: round(10.2%);
ceil: ceil(10.1px);
floor: floor(12.9px);
sqrt: sqrt(25px);
pi: pi();
mod: mod(13m, 11cm); // could take into account units, doesn't at the moment
abs: abs(-4%);
tan: tan(42deg);
sin: sin(10deg);
cos: cos(12);
atan: atan(tan(0.1rad));
atan: convert(acos(cos(34deg)), deg);
atan: convert(acos(cos(50grad)), deg);
pow: pow(8px, 2);
pow: pow(4, 3);
pow: pow(3, 3em);
min: min(0);
min: min(6, 5);
min: min(1pt, 3pt);
min: min(1cm, 3mm);
max: max(1, 3);
max: max(3em, 1em, 2em, 5em);
percentage: percentage((10px / 50));
color: color("#ff0011");
tint: tint(#777777, 13);
tint-full: tint(#777777, 100);
tint-percent: tint(#777777, 13%);
tint-negative: tint(#777777, -13%);
shade: shade(#777777, 13);
shade-full: shade(#777777, 100);
shade-percent: shade(#777777, 13%);
shade-negative: shade(#777777, -13%);
fade-out: fadeOut(red, 5%); // support fadeOut and fadeout
fade-in: fadein(fadeout(red, 10%), 5%);
-
+
hsv: hsv(5, 50%, 30%);
hsva: hsva(3, 50%, 30%, 0.2);
mix: mix(#ff0000, #ffff00, 80);
mix-0: mix(#ff0000, #ffff00, 0);
mix-100: mix(#ff0000, #ffff00, 100);
mix-weightless: mix(#ff0000, #ffff00);
mixt: mix(#ff0000, transparent);
.is-a {
color: iscolor(#ddd);
color1: iscolor(red);
color2: iscolor(rgb(0, 0, 0));
color3: iscolor(transparent);
keyword: iskeyword(hello);
number: isnumber(32);
string: isstring("hello");
pixel: ispixel(32px);
percent: ispercentage(32%);
em: isem(32em);
cat: isunit(32cat, cat);
}
}
#alpha {
alpha: darken(hsla(25, 50%, 50%, 0.6), 10%);
alpha2: alpha(rgba(3, 4, 5, 0.5));
alpha3: alpha(transparent);
}
#blendmodes {
multiply: multiply(#f60000, #f60000);
screen: screen(#f60000, #0000f6);
overlay: overlay(#f60000, #0000f6);
softlight: softlight(#f60000, #ffffff);
hardlight: hardlight(#f60000, #0000f6);
difference: difference(#f60000, #0000f6);
exclusion: exclusion(#f60000, #0000f6);
average: average(#f60000, #0000f6);
negation: negation(#f60000, #313131);
}
#extract-and-length {
@anon: A B C 1 2 3;
extract: extract(@anon, 6) extract(@anon, 5) extract(@anon, 4) extract(@anon, 3) extract(@anon, 2) extract(@anon, 1);
length: length(@anon);
}
~~~~~~~~~~
diff --git a/src/lint/linter/__tests__/lessc/media.lint-test b/src/lint/linter/__tests__/lessc/media.lint-test
index 4a8a8b42..47fdb938 100644
--- a/src/lint/linter/__tests__/lessc/media.lint-test
+++ b/src/lint/linter/__tests__/lessc/media.lint-test
@@ -1,235 +1,234 @@
-
// For now, variables can't be declared inside @media blocks.
@var: 42;
@media print {
.class {
color: blue;
.sub {
width: @var;
}
}
.top, header > h1 {
color: (#222 * 2);
}
}
@media screen {
@base: 8;
body { max-width: (@base * 60); }
}
@ratio_large: 16;
@ratio_small: 9;
@media all and (device-aspect-ratio: @ratio_large / @ratio_small) {
body { max-width: 800px; }
}
@media all and (orientation:portrait) {
aside { float: none; }
}
@media handheld and (min-width: @var), screen and (min-width: 20em) {
body {
max-width: 480px;
}
}
body {
@media print {
padding: 20px;
header {
background-color: red;
}
@media (orientation:landscape) {
margin-left: 20px;
}
}
}
@media screen {
.sidebar {
width: 300px;
@media (orientation: landscape) {
width: 500px;
}
}
}
@media a {
.first {
@media b {
.second {
.third {
width: 300px;
@media c {
width: 500px;
}
}
.fourth {
width: 3;
}
}
}
}
}
body {
@media a, b and c {
width: 95%;
@media x, y {
width: 100%;
}
}
}
.mediaMixin(@fallback: 200px) {
background: black;
@media handheld {
background: white;
@media (max-width: @fallback) {
background: red;
}
}
}
.a {
.mediaMixin(100px);
}
.b {
.mediaMixin();
}
@smartphone: ~"only screen and (max-width: 200px)";
@media @smartphone {
body {
width: 480px;
}
}
@media print {
@page :left {
margin: 0.5cm;
}
@page :right {
margin: 0.5cm;
}
@page Test:first {
margin: 1cm;
}
@page :first {
size: 8.5in 11in;
@top-left {
margin: 1cm;
}
@top-left-corner {
margin: 1cm;
}
@top-center {
margin: 1cm;
}
@top-right {
margin: 1cm;
}
@top-right-corner {
margin: 1cm;
}
@bottom-left {
margin: 1cm;
}
@bottom-left-corner {
margin: 1cm;
}
@bottom-center {
margin: 1cm;
}
@bottom-right {
margin: 1cm;
}
@bottom-right-corner {
margin: 1cm;
}
@left-top {
margin: 1cm;
}
@left-middle {
margin: 1cm;
}
@left-bottom {
margin: 1cm;
}
@right-top {
margin: 1cm;
}
@right-middle {
content: "Page " counter(page);
}
@right-bottom {
margin: 1cm;
}
}
}
@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (-o-min-device-pixel-ratio: 2/1), (min-resolution: 2dppx), (min-resolution: 128dpcm) {
.b {
background: red;
}
}
.bg() {
background: red;
@media (max-width: 500px) {
background: green;
}
}
body {
.bg();
}
@bpMedium: 1000px;
@media (max-width: @bpMedium) {
body {
.bg();
background: blue;
}
}
@media (max-width: 1200px) {
/* a comment */
@media (max-width: 900px) {
body { font-size: 11px; }
}
}
.nav-justified {
@media (min-width: 480px) {
> li {
display: table-cell;
}
}
}
.menu
{
@media (min-width: 768px) {
.nav-justified();
}
}
@all: ~"all";
@tv: ~"tv";
@media @all and @tv {
.all-and-tv-variables {
var: all-and-tv;
}
}
~~~~~~~~~~
diff --git a/src/lint/linter/__tests__/lessc/selectors.lint-test b/src/lint/linter/__tests__/lessc/selectors.lint-test
index c64ced6b..d76caa9b 100644
--- a/src/lint/linter/__tests__/lessc/selectors.lint-test
+++ b/src/lint/linter/__tests__/lessc/selectors.lint-test
@@ -1,157 +1,157 @@
h1, h2, h3 {
a, p {
&:hover {
color: red;
}
}
}
#all { color: blue; }
#the { color: blue; }
#same { color: blue; }
ul, li, div, q, blockquote, textarea {
margin: 0;
}
td {
margin: 0;
padding: 0;
}
td, input {
line-height: 1em;
}
a {
color: red;
&:hover { color: blue; }
div & { color: green; }
p & span { color: yellow; }
}
.foo {
.bar, .baz {
& .qux {
display: block;
}
.qux & {
display: inline;
}
- .qux& {
- display: inline-block;
- }
+ .qux& {
+ display: inline-block;
+ }
.qux & .biz {
display: none;
}
}
}
.b {
&.c {
.a& {
color: red;
}
}
}
.b {
.c & {
&.a {
color: red;
}
}
}
.p {
.foo &.bar {
color: red;
}
}
.p {
.foo&.bar {
color: red;
}
}
.foo {
.foo + & {
background: amber;
}
& + & {
background: amber;
}
}
.foo, .bar {
& + & {
background: amber;
}
}
.foo, .bar {
a, b {
& > & {
background: amber;
}
}
}
.other ::fnord { color: red }
.other::fnord { color: red }
.other {
::bnord {color: red }
&::bnord {color: red }
}
// selector interpolation
@theme: blood;
@selector: ~".@{theme}";
@{selector} {
color:red;
}
@{selector}red {
color: green;
}
.red {
#@{theme}.@{theme}&.black {
color:black;
}
}
@num: 3;
:nth-child(@{num}) {
- selector: interpolated;
+ selector: interpolated;
}
.test {
&:nth-child(odd):not(:nth-child(3)) {
color: #ff0000;
}
}
[prop],
[prop=10%],
[prop="value@{num}"],
[prop*="val@{num}"],
[|prop~="val@{num}"],
[*|prop$="val@{num}"],
[ns|prop^="val@{num}"],
[@{num}^="val@{num}"],
[@{num}=@{num}],
[@{num}] {
attributes: yes;
}
/*
Large comment means chunk will be emitted after } which means chunk will begin with whitespace...
blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank
blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank
blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank
blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank
blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank blank
*/
@{selector} {
color: red;
}
~~~~~~~~~~
diff --git a/src/lint/linter/__tests__/phlxhp/deprecated-function.lint-test b/src/lint/linter/__tests__/phlxhp/deprecated-function.lint-test
index f993c0a3..25ce3c96 100644
--- a/src/lint/linter/__tests__/phlxhp/deprecated-function.lint-test
+++ b/src/lint/linter/__tests__/phlxhp/deprecated-function.lint-test
@@ -1,6 +1,6 @@
This shouldn't fatal the parser.
~~~~~~~~~~
-error:1:10
\ No newline at end of file
+error:1:10
diff --git a/src/lint/linter/__tests__/xhpast/exit-expression.lint-test b/src/lint/linter/__tests__/xhpast/exit-expression.lint-test
index 55e8b048..96fbeb6f 100644
--- a/src/lint/linter/__tests__/xhpast/exit-expression.lint-test
+++ b/src/lint/linter/__tests__/xhpast/exit-expression.lint-test
@@ -1,8 +1,8 @@
\ No newline at end of file
+