Skip to content

Commit

Permalink
Fix lints and add coverage (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh authored Feb 22, 2024
1 parent ac46cf2 commit af3bc86
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 65 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Coverage
on:
pull_request:
push:
branches:
- master
jobs:
test:
name: Run tests with coverage
runs-on: ubuntu-latest
steps:
- uses: dart-lang/setup-dart@v1
with:
sdk: 'stable'
- uses: actions/checkout@v4
- run: dart pub get
- run: dart test --coverage=coverage
- name: Install coverage tools
run: dart pub global activate coverage
- name: format coverage
run: $HOME/.pub-cache/bin/format_coverage --lcov --in=coverage --out=coverage.lcov --report-on=lib
- name: Upload coverage reports to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.2.2]

* Fix some lints

## [0.2.1]

* Fix some lints
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This package is a pure Dart port of the original Java library.

For now, it only supports **QR-Code** (encoding and decoding). New format can easily be added if this port proves useful.

[![pub package](https://img.shields.io/pub/v/zxing2.svg)](https://pub.dartlang.org/packages/zxing2)
[![Build Status](https://github.com/xvrh/zxing-dart/workflows/Build/badge.svg?branch=master)](https://github.com/xvrh/zxing-dart)
[![codecov](https://codecov.io/gh/xvrh/zxing-dart/graph/badge.svg?token=UGGAJMNLBC)](https://codecov.io/gh/xvrh/zxing-dart)

<a href="https://www.buymeacoffee.com/xvrh" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60" width="217"></a>

## Getting started

### QR Code
Expand Down
6 changes: 6 additions & 0 deletions README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ This package is a pure Dart port of the original Java library.

For now, it only supports **QR-Code** (encoding and decoding). New format can easily be added if this port proves useful.

[![pub package](https://img.shields.io/pub/v/zxing2.svg)](https://pub.dartlang.org/packages/zxing2)
[![Build Status](https://github.com/xvrh/zxing-dart/workflows/Build/badge.svg?branch=master)](https://github.com/xvrh/zxing-dart)
[![codecov](https://codecov.io/gh/xvrh/zxing-dart/graph/badge.svg?token=UGGAJMNLBC)](https://codecov.io/gh/xvrh/zxing-dart)

<a href="https://www.buymeacoffee.com/xvrh" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60" width="217"></a>

## Getting started

### QR Code
Expand Down
4 changes: 2 additions & 2 deletions lib/src/common/string_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class StringUtils {
/// @param bytes bytes encoding a string, whose encoding should be guessed
/// @param hints decode hints if applicable
/// @return Charset of guessed encoding; at the moment will only guess one of:
/// {@link #SHIFT_JIS_CHARSET}, {@link StandardCharsets#UTF_8},
/// {@link StandardCharsets#ISO_8859_1}, or the platform default encoding if
/// {#SHIFT_JIS_CHARSET}, {@link StandardCharsets#UTF_8},
/// {StandardCharsets#ISO_8859_1}, or the platform default encoding if
/// none of these can possibly be correct
static CharacterSetECI guessCharset(Int8List bytes, DecodeHints hints) {
if (hints.contains(DecodeHintType.characterSet)) {
Expand Down
10 changes: 5 additions & 5 deletions lib/src/encode_hint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'common/character_set_eci.dart';
class EncodeHintType<T> {
/// Specifies what degree of error correction to use, for example in QR Codes.
/// Type depends on the encoder. For example for QR codes it's type
/// {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
/// {com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
/// For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
/// For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
/// In all cases, it can also be a {@link String} representation of the desired value as well.
Expand All @@ -25,16 +25,16 @@ class EncodeHintType<T> {
static final margin = EncodeHintType<Object>();

/// Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
/// {@link String} value).
/// {String} value).
static final pdf417Compact = EncodeHintType<Object>();

/// Specifies what compaction mode to use for PDF417 (type
/// {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
/// {com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
/// enum values).
static final pdf417Compaction = EncodeHintType<Object>();

/// Specifies the minimum and maximum number of rows and columns for PDF417 (type
/// {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
/// {com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
//static final PDF417_DIMENSIONS = EncodeHintType<Dimensions>();

/// Specifies the required number of layers for an Aztec code.
Expand All @@ -55,7 +55,7 @@ class EncodeHintType<T> {
static final qrMaskPattern = EncodeHintType<int>();

/// Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
/// {@link String } value).
/// {String} value).
static final gs1Format = EncodeHintType<bool>();
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/luminance_source.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract class LuminanceSource {
Int8List getRow(int y, Int8List? row);

/// Fetches luminance data for the underlying bitmap. Values should be fetched using:
/// {@code int luminance = array[y * width + x] & 0xff}
/// {int luminance = array[y * width + x] & 0xff}
///
/// @return A row-major 2D array of luminance values. Do not use result.length as it may be
/// larger than width * height bytes on some platforms. Do not modify the contents
Expand Down
4 changes: 2 additions & 2 deletions lib/src/qrcode/decoder/bit_matrix_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ class BitMatrixParser {

/// Prepare the parser for a mirrored operation.
/// This flag has effect only on the {@link #readFormatInformation()} and the
/// {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the
/// {@link #mirror()} method should be called.
/// {#readVersion()}. Before proceeding with {@link #readCodewords()} the
/// {#mirror()} method should be called.
///
/// @param mirror Whether to read version and format information mirrored.
void setMirror(bool mirror) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/qrcode/detector/detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Detector {
}

/// <p>Estimates module size based on two finder patterns -- it uses
/// {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
/// {#sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the
/// width of each, measuring along the axis between their centers.</p>
double _calculateModuleSizeOneWay(
ResultPoint pattern, ResultPoint otherPattern) {
Expand Down
Loading

0 comments on commit af3bc86

Please sign in to comment.