1.0.2 • Published 9 months ago

php-codesniffer v1.0.2

Weekly downloads
16
License
MIT
Repository
github
Last release
9 months ago

php-codesniffer codecov

Executes phpcs over a given file(s) and return results as JSON. Written in TypeScript, good test coverage, no dependencies.

import { version, lint } from './linter';

it('returns version', async () => {
  expect(await version('php ./test/phpcs.phar')).toBe('3.5.5');
  expect(semver.valid(await version())).toBeTruthy();
});

it('lints several files', async () => {
  const res = await lint(
    './test/fixtures/test1.php ./test/fixtures/test2.php',
    undefined,
    {
      standard: path.resolve(
        __dirname,
        '../test/preferBeautifierConfig/subFolder/phpcs.xml',
      ),
    },
  );
  expect(res.totals).toMatchInlineSnapshot(`
      Object {
        "errors": 13,
        "fixable": 13,
        "warnings": 1,
      }
    `);
  expect(Object.values(res.files)).toMatchSnapshot();
});

License

MIT

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.0.1

9 months ago