Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
やさしいコーディング規約の導入
Search
fortkle
January 13, 2016
Technology
4.7k
10
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
やさしいコーディング規約の導入
fortkle
January 13, 2016
More Decks by fortkle
See All by fortkle
無駄な物をなるべく作らないリプレイス戦略 / replace-strategy-phperkaigi2021
fortkle
1
2.7k
フルリモート時代のカンバン運用 / kanban-operation-in-remote
fortkle
0
800
GitHub Actionsで始めるPHPアプリケーションのCI実践入門 / ga-phperkaigi2020
fortkle
3
7k
余裕を生み出すコードレビュー 〜レビュイー編〜 / code-review-phpcon-2019
fortkle
8
7.6k
「設計振り返り」を始めてみようと思っている話 / architecture reflection
fortkle
3
640
「ママ向けNo.1アプリ」の 更なる成長を支える仕組み / startup-engineer-night-connehito
fortkle
2
370
良いテストデータ、悪いテストデータ / testdata-antipattern
fortkle
4
7k
BackstopJSで始める CSSリグレッションテスト / backstopjs-css-test
fortkle
0
1.6k
PhpStorm導入アンチパターン / phpstorm-anti-pattern
fortkle
0
2.2k
Other Decks in Technology
See All in Technology
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
2.9k
Kiro Meetup #8 Kiro アップデート (2026/3/21〜2026/9/24)
katzueno
1
150
現場で役立つ技術負債の効果的な返済方法
masuda220
PRO
11
5.1k
beyond jj: config & tools ecosystem
indirect
0
5.9k
ADKで始める業務改善 - AIエージェント開発時の考えと設計
harappa80
2
270
AIは推し活である。
kurazuuuuuu
1
950
Vibe Coding で作ったプロダクトをどう安全に動かすか / How to Safely Run Products Built with Vibe Coding
glidenote
0
510
アクセスキーこわい やめかたと漏らさない工夫
sassssan68
1
640
今話題のAI「Jev」って何? 宇宙最速で学ぶ会
minorun365
PRO
30
19k
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.9k
データ界隈LT祭 第1回LT登壇
taromatsui_cccmkhd
2
1.5k
AgentCore Runtime上にAgentic Coding基盤を構築・展開する際の設計ポイントと限界点 / Design considerations and limitations when building an agentic coding platform on AgentCore Runtime
har1101
5
690
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Crafting Experiences
bethany
1
350
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
340
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Utilizing Notion as your number one productivity tool
mfonobong
4
590
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
570
Prompt Engineering for Job Search
mfonobong
0
460
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
3
4.3k
Code Review Best Practice
trishagee
74
20k
Product Roadmaps are Hard
iamctodd
55
13k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
Facilitating Awesome Meetings
lara
57
7.1k
Transcript
͍͞͠ ίʔσΟϯάنͷಋೖ ߴ ߊ @fortkle - PHP BLT #2
ࣗݾհ • @fortkle • Connehito גࣜձࣾʢϚϚ͚αʔϏε mamariʣ • ୲ྖҬϑϩϯτʙαʔόʔαΠυ •
࠷ۙͷझຯɺvimʹlintܥϓϥάΠϯΛೖΕ· ͬͯ͘ϓϥάΠϯʹౖΒΕ·͘Δ͜ͱ
None
ޚࣾͷίʔσΟϯάنɺ ػೳͯ͠·͔͢ʁ 143 143 ΦϨΦϨ ;FOE $BLF1)1 4ZNGPOZ
None
ίʔσΟϯάن͕ͳ͍ͱਏ͍ • ίʔυϨϏϡʔͷࡍʹࠣࡉͳΓऔΓ͕ൃੜ (εϖʔεɺΠϯσϯτɺվߦҐஔ) • ίʔυελΠϧ͕౷Ұ͞Εͳ͘ͳΓอकੑͷ Լ • ଞਓ͕ॻ͍ͨίʔυͷՄಡੑ͕Լ͕Δ
ͳΜͱ͔͠ͳ͍ͱ…!
3STEPͰίʔσΟϯάنΛ खʹೖΕΔ
ͨͱ͑…͜ΜͳPJT • طʹ։ൃ͕͔ͳΓਐΜͰ͍ΔPJT • ίʔσΟϯάنࠓͷͱ͜Ζͳ͍ • ނʹphpcsͳͲΛී௨ʹ͏ͱΤϥʔ͕େྔ ʹग़ͯਏ͍ => Ͳ͏ͬͯίʔσΟϯάنΛ࡞Δ͔ʁ
STEP1. ࠾༻͢ΔنΛܾΊΔ • ࠓ͔Β৽͘͠ίʔσΟϯάنΛ࠾༻͢Δͱ ͨ͠ΒPSR-2 • ࣍Ͱ༻͍ͯ͠ΔFWಠࣗͷن(ex. Cake)
STEP2. νΣοΫπʔϧΛ༻ҙ • StyleCIScrutinizerͳͲͷSaas͋Δ͕ ͓ೃછΈ phpcs (PHP CodeSniffer) ͕͓͢͢Ί •
ΧελϚΠζੑͷߴ͞ɺແྉɺ(ރΕͯΔ) • ͨͩ͠ී௨ʹ্ͬͯख͘ߦ͔ͳ͍
ී௨ʹΔͱ͜͏ͳΔ Τϥʔग़ྗߦ 65,000…….. ࣮ߦ࣌ؒ 27ඵ… ※ Vender/ Plugin/ ԼؚΜͰ͍ΔͷͰ࣮ࡍͬͱগͳ͘ͳΓ·͢ʢͬͨʣ
None
͏·͍͘͘phpcs
STEP2. νΣοΫπʔϧΛ༻ҙ • pearͰͳ͘composerͰΠϯετʔϧ // Πϯετʔϧ $ composer require “squizlabs/php_codesniffer=*"
--dev // ֬ೝʢར༻Ͱ͖ΔنΛදࣔʣ $ vendor/bin/phpcs -i
STEP2. νΣοΫπʔϧΛ༻ҙ • phpcsxmlͰنΛΧελϚΠζͰ͖Δ • STEP1ͰܾΊͨنΛܧঝ͚ͨͩ͠ͷϑΝΠ ϧ phpcs.xmlΛͭ͘Δ // phpcs.xml
<?xml version="1.0"?> <ruleset name="Owl_PSR2"> <description>Owl standard Based on PSR2</description> <rule ref="PSR2" /> </ruleset>
STEP2. νΣοΫπʔϧΛ༻ҙ • ͓ΉΖʹɺԼهίϚϯυΛΞϓϦέʔγϣϯ શମ (./app) ʹର࣮ͯ͠ߦ $ vendor/bin/phpcs -s
--report=source --standard=./ phpcs.xml ./app
STEP2. νΣοΫπʔϧΛ༻ҙ • Τϥʔͱͯ͠ݕग़͞ΕͨنͱΤϥʔ͕݅ ιʔτ͞Εͯදࣔ͞ΕΔʢศར..!ʣ
STEP2. νΣοΫπʔϧΛ༻ҙ • ΤϥʔʹͳͬͨنΛҰશͯআ֎ (phpcs.xmlʹه) <?xml version="1.0"?> <ruleset name="Owl_PSR2"> <description>Owl
standard Based on PSR2</description> <rule ref="PSR2"> <exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed"/> <!-- 145 --> <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/> <!-- 21 --> <exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine"/> <!-- 18 --> <exclude name="Generic.Files.LineLength.TooLong"/> <!-- 17 --> <exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody"/> <!-- 16 --> <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/> <!-- 9 --> <exclude name="Squiz.Functions.MultiLineFunctionDeclaration"/> <!-- 1 --> <exclude name="Generic.WhiteSpace.ScopeIndent.Incorrect"/> <!-- 1 --> </rule> </ruleset>
STEP2. νΣοΫπʔϧΛ༻ҙ • ࠶phpcsΛ࣮ߦ͢ΔͱΤϥʔ͕ग़ͳ͘ͳΔɻ ˠ ʮ؇͍CodeSnifferʯͷ $ vendor/bin/phpcs -s --report=source
--standard=./ phpcs.xml ./app $ // Τϥʔ͕ͳ͍ͷͰ࣮ߦͯ͠Կදࣔ͞Εͳ͍
STEP2. νΣοΫπʔϧΛ༻ҙ • ࡉ͔͘ϑΣʔζΛ͚ͯ1ͭ1ͭআ֎ϧʔϧΛফ ͍ͯ͘͠ => ͍͔ͭࣗવͱඪͷنʹͳΔʂ <?xml version="1.0"?> <ruleset
name="Owl_PSR2"> <description>Owl standard Based on PSR2</description> <rule ref="PSR2"> <!-- Կͳ͘ͳΔͱPSR-2ͱಉ༷ͷϧʔϧͱͳΔʂ --> </rule> </ruleset>
STEP2. νΣοΫπʔϧΛ༻ҙ • STEP2·ͱΊ 1. ඪ(͜͜ͰPSR2)ΛϕʔεʹΤϥʔͱͳ͍ͬͯΔ ϧʔϧΛআ֎͠ɺʮ؇͍نʯΛ࡞Δ 2. ϑΣʔζຖʹϧʔϧͷআ֎ΛΊ͍͖ͯɺ গͣͭ͠ඪʹ͚͍ۙͮͯ͘
3. શͯͷϧʔϧͷআ֎ΛΊͨ࣌ɺඪͱಉ͡نͱͳΔ
STEP3. CIʹΈࠐΈࣗಈ࣮ߦ • TravisCIΛ͍ͬͯͨ߹ • .travis.ymlʹॲཧΛՃࣗ͠ಈͰ࣮ߦ͞ΕΔΑ ͏ʹ͢Δ • νΣοΫରΛίϛοτ͞ΕͨϑΝΠϧͷ͏ͪ phpϑΝΠϧͷΈʹݶఆ͢Δ
(shʹ·ͱΊͯྑ͍)
STEP3. CIʹΈࠐΈࣗಈ࣮ߦ // .travis.yml ~ུ~ before_script: # full clone -
git fetch --unshallow - git fetch origin master:refs/remotes/origin/ master # setup application - sh ./setup_app.sh # exec codeSniffer - git diff --name-only --diff-filter=ACMR origin/master...HEAD | grep ".php" | xargs vendor/bin/phpcs --standard=./phpcs.xml PSJHJONBTUFSͱ )&"%Λൺֱ͚ͯࠩͩ͠ νΣοΫ
STEP3. CIʹΈࠐΈࣗಈ࣮ߦ shͰ·ͱΊɺϝοηʔδΛදࣔ͢ΕΑΓɻ Τϥʔ͕͋ͬͨ߹Ϗϧυ͕ࣦഊ͢Δɻ
·ͱΊ • ؇͍ϧʔϧ͔Β࢝Ίͯඪ(PSR-2)ʹ͍͍ۙͮͯ͘ Ξϓϩʔν͕Φεεϝ • ίϛοτͨ͠ϑΝΠϧͷΈΛphpcsͷݕࠪରͱ ͠ɺTravisͰࣗಈ࣮ߦ͢Δͱָ • ࠓ·ͰίʔσΟϯάنΛఘΊ͍ͯͨ͋ͷPJT ͍͔ͭPSR-2ʹ४ڌͰ͖Δ͔ʁ
͓͠·͍