Skip to content
Permalink
Browse files
Code formatting
  • Loading branch information
cedx committed May 17, 2020
1 parent 1bb8446 commit 6cb8af7960a1cfd0ecdaf0b3d9d5453e35bc05a8
Showing with 1,225 additions and 2,472 deletions.
  1. +4 −3 .editorconfig
  2. +21 −21 .github/workflows/build.yaml
  3. +0 −1 .gitignore
  4. +5 −5 .vscode/settings.json
  5. +33 −33 composer.json
  6. +31 −31 etc/mkdocs.yaml
  7. +3 −3 etc/terser.json
  8. +40 −40 example/index.html
  9. +25 −25 example/main.hx
  10. +21 −21 example/main.js
  11. +20 −20 example/main.php
  12. +9 −9 haxelib.json
  13. +1 −1 lib/js/index.cjs
  14. +1 −1 lib/js/index.d.ts
  15. +2 −2 lib/js/index.mjs
  16. +0 −148 lib/php/lcov/BranchCoverage.php
  17. +0 −112 lib/php/lcov/BranchData.php
  18. +0 −169 lib/php/lcov/FunctionCoverage.php
  19. +0 −105 lib/php/lcov/FunctionData.php
  20. +0 −50 lib/php/lcov/LcovException.php
  21. +0 −148 lib/php/lcov/LineCoverage.php
  22. +0 −106 lib/php/lcov/LineData.php
  23. +0 −139 lib/php/lcov/Record.php
  24. +0 −268 lib/php/lcov/Report.php
  25. +43 −43 package.json
  26. +3 −3 readthedocs.yaml
  27. +43 −43 src/lcov/BranchCoverage.hx
  28. +48 −48 src/lcov/BranchData.hx
  29. +45 −45 src/lcov/FunctionCoverage.hx
  30. +43 −43 src/lcov/FunctionData.hx
  31. +22 −26 src/lcov/LcovException.hx
  32. +43 −43 src/lcov/LineCoverage.hx
  33. +42 −42 src/lcov/LineData.hx
  34. +59 −57 src/lcov/Record.hx
  35. +116 −116 src/lcov/Report.hx
  36. +26 −26 src/lcov/Token.hx
  37. +1 −1 src/lcov/import.hx
  38. +2 −2 src/php/JsonSerializable.hx
  39. +1 −1 src/php/UnexpectedValueException.hx
  40. +13 −13 test/Main.hx
  41. +52 −52 test/lcov/BranchCoverageTest.hx
  42. +43 −43 test/lcov/BranchDataTest.hx
  43. +53 −53 test/lcov/FunctionCoverageTest.hx
  44. +47 −47 test/lcov/FunctionDataTest.hx
  45. +52 −52 test/lcov/LineCoverageTest.hx
  46. +38 −38 test/lcov/LineDataTest.hx
  47. +53 −53 test/lcov/RecordTest.hx
  48. +92 −92 test/lcov/ReportTest.hx
  49. +1 −1 tool/clean.ps1
  50. +2 −2 tool/dist.ps1
  51. +10 −10 tool/doc.ps1
  52. +8 −8 tool/version.ps1
  53. +8 −8 tool/watch.ps1
@@ -3,11 +3,12 @@ root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
indent_style = tab
insert_final_newline = true
max_line_length = 200
quote_type = double
tab_width = 2
trim_trailing_whitespace = true

[*.md]
indent_size = 4
trim_trailing_whitespace = false
@@ -1,24 +1,24 @@
name: build
on:
pull_request:
push:
schedule:
- cron: '0 0 1 * *'
pull_request:
push:
schedule:
- cron: "0 0 1 * *"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Haxe
uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.0.5
- name: Check environment
run: |
haxe --version
haxelib version
- name: Fetch sources
uses: actions/checkout@v2
- name: Install dependencies
run: haxelib install all --always
- name: Run tests
run: haxe test.hxml
test:
runs-on: ubuntu-latest
steps:
- name: Set up Haxe
uses: krdlab/setup-haxe@v1
with:
haxe-version: 4.1.0
- name: Check environment
run: |
haxe --version
haxelib version
- name: Fetch sources
uses: actions/checkout@v2
- name: Install dependencies
run: haxelib install all --always
- name: Run tests
run: haxe test.hxml
@@ -16,4 +16,3 @@
/npm-debug.log
/package-lock.json
/lib/js/lcov.*
/share/*.private.env.json
@@ -1,7 +1,7 @@
{
"editor.insertSpaces": true,
"editor.tabSize": 2,
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
"editor.insertSpaces": false,
"editor.tabSize": 2,
"files.encoding": "utf8",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
}
@@ -1,35 +1,35 @@
{
"description": "Parse and format to LCOV your code coverage reports. The best way to share your code coverage stats.",
"homepage": "https://docs.belin.io/lcov.hx",
"license": "MIT",
"name": "cedx/lcov.hx",
"type": "library",
"authors": [
{"email": "cedric@belin.io", "homepage": "https://belin.io", "name": "Cédric Belin"}
],
"autoload": {
"psr-4": {"lcov\\": "lib/php/lcov/"}
},
"config": {
"optimize-autoloader": true
},
"funding": [
{"type": "patreon", "url": "https://www.patreon.com/cedx"}
],
"keywords": [
"coverage",
"formatter",
"lcov",
"parser",
"test"
],
"require": {
"php": ">=7.0.0",
"ext-json": "*",
"cedx/haxe": "^0.1.2"
},
"support": {
"docs": "https://api.belin.io/lcov.hx",
"issues": "https://git.belin.io/cedx/lcov.hx/issues"
}
"description": "Parse and format to LCOV your code coverage reports. The best way to share your code coverage stats.",
"homepage": "https://docs.belin.io/lcov.hx",
"license": "MIT",
"name": "cedx/lcov.hx",
"type": "library",
"authors": [
{"email": "cedric@belin.io", "homepage": "https://belin.io", "name": "Cédric Belin"}
],
"autoload": {
"psr-4": {"lcov\\": "lib/php/lcov/"}
},
"config": {
"optimize-autoloader": true
},
"funding": [
{"type": "patreon", "url": "https://www.patreon.com/cedx"}
],
"keywords": [
"coverage",
"formatter",
"lcov",
"parser",
"test"
],
"require": {
"php": ">=7.0.0",
"ext-json": "*",
"cedx/haxe": "^0.1.2"
},
"support": {
"docs": "https://api.belin.io/lcov.hx",
"issues": "https://git.belin.io/cedx/lcov.hx/issues"
}
}
@@ -8,43 +8,43 @@ site_dir: ../www

repo_name: git.belin.io
repo_url: https://git.belin.io/cedx/lcov.hx
edit_uri: ''
edit_uri: ""

copyright: Copyright © 2020 Cédric Belin
extra:
social:
- icon: fontawesome/solid/globe
link: 'https://belin.io'
- icon: fontawesome/brands/github
link: 'https://github.com/cedx'
- icon: fontawesome/brands/twitter
link: 'https://twitter.com/cedxbelin'
- icon: fontawesome/brands/linkedin
link: 'https://linkedin.com/in/cedxbelin'
social:
- icon: fontawesome/solid/globe
link: "https://belin.io"
- icon: fontawesome/brands/github
link: "https://github.com/cedx"
- icon: fontawesome/brands/twitter
link: "https://twitter.com/cedxbelin"
- icon: fontawesome/brands/linkedin
link: "https://linkedin.com/in/cedxbelin"

markdown_extensions:
- admonition
- codehilite
- meta
- toc:
permalink: true
- admonition
- codehilite
- meta
- toc:
permalink: true

nav:
- Overview: index.md
- Installation: installation.md
- Usage: usage.md
- About:
- License: about/license.md
- See also: about/see_also.md
- Overview: index.md
- Installation: installation.md
- Usage: usage.md
- About:
- License: about/license.md
- See also: about/see_also.md

theme:
favicon: img/favicon.ico
features:
- instant
icon:
logo: fontawesome/solid/book-reader
repo: fontawesome/brands/git-alt
name: material
palette:
accent: amber
primary: amber
favicon: img/favicon.ico
features:
- instant
icon:
logo: fontawesome/solid/book-reader
repo: fontawesome/brands/git-alt
name: material
palette:
accent: amber
primary: amber
@@ -1,5 +1,5 @@
{
"compress": true,
"ecma": 2020,
"mangle": true
"compress": true,
"ecma": 2020,
"mangle": true
}
@@ -1,34 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LCOV for JS</title>
<script src="https://cdn.jsdelivr.net/npm/@cedx/lcov.hx/build/lcov.min.js"></script>
</head>

<body>
<p>Open the console provided by the development tools of your browser...</p>

<script>
// Import the classes.
const {FunctionCoverage, LineCoverage, LineData, Record, Report} = window.lcov;

// Format coverage data as LCOV report.
const lineCoverage = new LineCoverage(2, 2, [
new LineData(6, 2, 'PF4Rz2r7RTliO9u6bZ7h6g'),
new LineData(7, 2, 'yGMB6FhEEAd8OyASe3Ni1w')
]);

const record = new Record('/home/cedx/lcov.hx/fixture.hx', {
functions: new FunctionCoverage(1, 1),
lines: lineCoverage
});

const report = new Report('Example', [record]);
console.log(report.toString());

// Parse a LCOV report to coverage data.
const coverage = `
<head>
<meta charset="UTF-8">
<title>LCOV for JS</title>
<script src="https://cdn.jsdelivr.net/npm/@cedx/lcov.hx/build/lcov.min.js"></script>
</head>

<body>
<p>Open the console provided by the development tools of your browser...</p>

<script>
// Import the classes.
const {FunctionCoverage, LineCoverage, LineData, Record, Report} = window.lcov;

// Format coverage data as LCOV report.
const lineCoverage = new LineCoverage(2, 2, [
new LineData(6, 2, "PF4Rz2r7RTliO9u6bZ7h6g"),
new LineData(7, 2, "yGMB6FhEEAd8OyASe3Ni1w")
]);

const record = new Record("/home/cedx/lcov.hx/fixture.hx", {
functions: new FunctionCoverage(1, 1),
lines: lineCoverage
});

const report = new Report("Example", [record]);
console.log(report.toString());

// Parse a LCOV report to coverage data.
const coverage = `
TN:Example
SF:/home/cedx/lcov.hx/fixture.hx
FN:4,main
@@ -43,15 +43,15 @@
LH:4
end_of_record`;

try {
const report = Report.fromCoverage(coverage);
console.log(`The coverage report contains ${report.records.length} record(s):`);
console.log(JSON.stringify(report, null, 2));
}

catch (error) {
console.log(`An error occurred: "${error.message}" at offset ${error.offset}.`);
}
</script>
</body>
try {
const report = Report.fromCoverage(coverage);
console.log(`The coverage report contains ${report.records.length} record(s):`);
console.log(JSON.stringify(report, null, 2));
}

catch (error) {
console.log(`An error occurred: "${error.message}" at offset ${error.offset}.`);
}
</script>
</body>
</html>
@@ -5,33 +5,33 @@ import sys.io.File;
/** A sample class. **/
class Example {

/** Formats coverage data as LCOV report. **/
public function formatReport(): Void {
final lineCoverage = new LineCoverage(2, 2, [
new LineData(6, 2, 'PF4Rz2r7RTliO9u6bZ7h6g'),
new LineData(7, 2, 'yGMB6FhEEAd8OyASe3Ni1w')
]);
/** Formats coverage data as LCOV report. **/
public function formatReport(): Void {
final lineCoverage = new LineCoverage(2, 2, [
new LineData(6, 2, "PF4Rz2r7RTliO9u6bZ7h6g"),
new LineData(7, 2, "yGMB6FhEEAd8OyASe3Ni1w")
]);

final record = new Record('/home/cedx/lcov.hx/fixture.hx', {
functions: new FunctionCoverage(1, 1),
lines: lineCoverage
});
final record = new Record("/home/cedx/lcov.hx/fixture.hx", {
functions: new FunctionCoverage(1, 1),
lines: lineCoverage
});

final report = new Report('Example', [record]);
trace(report.toString());
}
final report = new Report("Example", [record]);
trace(report.toString());
}

/** Parses a LCOV report to coverage data. **/
public function parseReport(): Void {
try {
final coverage = File.getContent('/path/to/lcov.info');
final report = Report.fromCoverage(coverage);
Sys.println('The coverage report contains ${report.records.length} records:');
Sys.println(Json.stringify(report.toJson(), null, ' '));
}
/** Parses a LCOV report to coverage data. **/
public function parseReport(): Void {
try {
final coverage = File.getContent("/path/to/lcov.info");
final report = Report.fromCoverage(coverage);
Sys.println('The coverage report contains ${report.records.length} records:');
Sys.println(Json.stringify(report.toJson(), null, " "));
}

catch (error: LcovException) {
Sys.println('An error occurred: "${error.message}" at offset ${error.offset}.');
}
}
catch (error: LcovException) {
Sys.println('An error occurred: "${error.message}" at offset ${error.offset}.');
}
}
}

0 comments on commit 6cb8af7

Please sign in to comment.