Slide 1

Slide 1 text

੩తίʔυղੳ Dart/FlutterͷͨΊͷ

Slide 2

Slide 2 text

Ͷ͜·͍͚Δ @KURONEKOMICHAEL

Slide 3

Slide 3 text

੩తίʔυղੳͯ͠· ͔͢ʁʂ ΈΜͳʂ

Slide 4

Slide 4 text

֤ݴޠຖͷ੩తίʔυղੳπʔϧ PHP = PHPMD, PHPCS JAVASCRIPT = ESLINT GOLANG = GOLINT DART = ?

Slide 5

Slide 5 text

DARTANALYZER DARTެࣜͷ੩తίʔυղੳπʔϧ

Slide 6

Slide 6 text

DART SDKʹಉࠝ͞Ε͍ͯΔͷͰɺ͙͢ʹ࢖͑Δʂ

Slide 7

Slide 7 text

IDE্Ͱ΋੩తίʔυղੳͷ݁Ռ͕֬ೝՄೳ

Slide 8

Slide 8 text

ϧʔϧͷΧελϚΠζ΋؆୯ ΧϨϯτσΟϨΫτϦʹʮanalysis_options.yamlʯΛஔ͚ͩ͘ʂ analyzer: strong-mode: implicit-dynamic: false errors: # treat missing required parameters as a warning (not a hint) missing_required_param: warning # treat missing returns as a warning (not a hint) missing_return: warning # allow having TODOs in the code todo: ignore exclude: - 'bin/cache/**' # the following two are relative to the stocks example and the flutter package respectively # see https://github.com/dart-lang/sdk/issues/28463 - 'lib/i18n/stock_messages_*.dart' - 'lib/src/http/**' linter: rules: # these rules are documented on and in the same order as # the Dart Lint rules page to make maintenance easier # https://github.com/dart-lang/linter/blob/master/example/all.yaml - always_declare_return_types - always_put_control_body_on_new_line # - always_put_required_named_parameters_first # we prefer having parameters in the same order as fields https://github.com/flutter/ flutter/issues/10219 - always_require_non_null_named_parameters - always_specify_types

Slide 9

Slide 9 text

Զʹ͸ψϧ͍ ඪ४ͷϧʔϧ͸

Slide 10

Slide 10 text

Φεεϝઃఆ ϚʔΫ ඪ४ͩͱϧʔϧ͕ψϧ͍ͷͰɺ Flutterެࣜͷ analysis_options.yaml ͕Φεεϝ ΄ͲΑ͘ݫ͘͠ ㅟ ㅟ ㅟ ΑΓϞμϯʹ ㅟ ㅟ ㅟ https://github.com/flutter/flutter

Slide 11

Slide 11 text

ਓؒ͸ؒҧ͍Λ ൜͢ಈ෺Ͱ͋Δ

Slide 12

Slide 12 text

ͦΕͰ΋ବ໨ίʔ υ͸ฆΕࠐΉ

Slide 13

Slide 13 text

ଵଦ͸৺ͷ ຾Γͩɻ (BOTʹ೚ͤΑ͏) ϰΥʔϰφϧά ňল࡯ͱ֨ݴʼn

Slide 14

Slide 14 text

CONTINUS INTEGRATION CIͰࣗಈԽ͠Α͏ Github Pull Request + Circle CI + dartanalyzer

Slide 15

Slide 15 text

dartanalyzer ᶃ Pull RequestΛpush ᶄJOBΛىಈ ᶅղੳ࣮ߦ ᶆ݁ՌͷҾ͖౉͠ ᶇPull Request্Ͱࢦఠ

Slide 16

Slide 16 text

STEP 1 (ඞཁʹԠͯ͡)dartanalyzerͷϧʔϧϑΝΠϧΛೖΕΔ analysis_options.yaml $ curl -O https://raw.githubusercontent.com/flutter/flutter/stable/analysis_options.yaml

Slide 17

Slide 17 text

STEP 2 CircleCIͷઃఆϑΝΠϧΛίϛοτ͢Δ .circleci/config.yml version: 2 jobs: lint: docker: - image: kuronekomichael/flutter:stable steps: - checkout - run: 'flutter packages get' - run: 'dartcop . | reviewdog -f=checkstyle -name=dartcop -reporter=github-pr-review' workflows: version: 2 build_and_test: jobs: - lint

Slide 18

Slide 18 text

STEP 3 CircleCIΛઃఆ͢Δ ▸ Point1. reviewdog͔ΒPull RequestʹίϝϯτͰ͖ΔΑ͏ɺ ؀ڥม਺ʹGitHubͷAPIτʔΫϯΛઃఆͯ͋͛͠Δ
 REVIEWDOG_GITHUB_API_TOKEN ▸ Point2. Pull Request͚ͩδϣϒΛ૸ΒͤΔΑ͏ઃఆ
 [Settings]-[Advanced Settings]-[Only build pull requests]
 ●On

Slide 19

Slide 19 text

ט·ΕΔ☺

Slide 20

Slide 20 text

खલຯḩͳ࿩ 1. dartanalyzerͷϥούʔʮdartcopʯ dartanalyzer͸ಠࣗܗࣜͷग़ྗ͔͠ରԠ͍ͯ͠ͳ͍ ͷͰɺreviewdog͕ಡΈࠐΈͰ͖ΔΑ͏ʹϥούʔ ͷπʔϧΛ࣮૷͠·ͨ͠ ຊ౰͸reviewdogͷefmͰ࣮ݱग़དྷΔ͸ͣͳΜͰ͕͢ɺ͝ΊΜͳ͍͞... https://github.com/kuronekomichael/dartcop 2. Dart/Flutter༻ͷdockerΠϝʔδʮkuronekomichael/flutterʯ LinuxϕʔεͰ͕͢ɺflutter SDKΛؚΊ dartanalyzer,্هͷdartcop,reviewdog΋ؚΊͯશ ෦ͥΜͿೖΕͪΌͬͨDockerΠϝʔδɻେ͖Ίɻ https://hub.docker.com/r/kuronekomichael/flutter/dockerfile

Slide 21

Slide 21 text

HAPPY HACKING!!