Kang-min Liu
LINE Fukuoka
https://hackmd.io/@gugod/r13BV_FVr#/
❓ 🖐 ㉄
Kang-min Liu / 劉康民
Twitter: @gugod
Perl
Server-side dev
LINE Creator Market
3 frontend devs
4 server-side devs
frontend: angularjs → vue.js
server: perl, mysql, nginx, memcached
git push
→ CIGain understandings on
Readibility > Correctness
Maintainability > Optimized solution
Unconventional
Quirks, magic, shenanigans
Mismatching style
Random "code waste"
Can I understand this new piece code
written by my teammate
by just reading it ?
understandable code →→→ maintainable code
perl -c
Perl::Critic / Perl::Lint
CPAN::Audit
eslint https://eslint.org/
CI
Continuous Testing (Test::Continuous)
All pair testing
Mutation Test (Devel::Mutation)
fuzzing
Note:
Why using "LaTeX" instead of $whatever ?
How many time you've spent on configuring the fonts & color of your Termnial / Editor?
You probably dislike Comic Sans font for a reason.
$EDITOR
Critique Perl source code for best-practices.
Perl::Critic is a static code analysis system for the Perl programming language. Perl::Critic is available as a source-code distribution on CPAN. It comes with a commandline tool, perlcritic, which can check Perl source code files and report on the code quality therein. Perl::Critic has an extensible architecture that allows the programmer to choose from many "policies" which enforce different Perl programming styles and tastes.
http://shop.oreilly.com/product/9780596001735.do
Online Demo
Bad: too much work.
if ( grep { $_->can_code() } @people ) {
say "Developers!";
}
Better: just enough amount of work
use List::Util 'first';
if ( first { $_->can_code() } @people ) {
say "Developers!";
}
my $is_product = $object =~ m/
\A (?: sticker | theme | emoji ) \z
/xms;
my $is_product = $object eq 'sticker' ||
$object eq 'theme' ||
$object eq 'emoji';
my $is_product = first { $object eq $_ } (
'sticker', 'theme', 'emoji'
);
use Quantum::Superposition 'any';
my $is_product = $object eq any('sticker', 'theme', 'emoji');
# perl6
my $is_product = $object eq 'sticker'|'theme'| 'emoji';
https://metacpan.org/pod/Perl::Critic::TooMuchCode
do_this();;
Extra semi-colons / empty statements.Jenkins
Travis
CircleCI
Drone CI
Reviewdog を飼ってコードレビューや開発を改善しませんか
http://haya14busa.com/reviewdog/
Let CI do some code reviews
# .reviewdog.yml
runner:
perlcritic:
cmd: perlcritic --profile .perlcriticrc --verbose 1 *.psgi lib/
errorformat:
- "%f:%l:%c:%m"
name: perlcritic
https://hub.docker.com/r/gugod/perlcritic-reviewdog
Usable in Drone CI.
Scan dependency graph for
known vulnerabilities
Mutation Testing
Original
if (a && b) {
do_this();
}
Mutant
if (a || b) {
do_this();
}
🖖 "Thank you for listening"; 🤟
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing