{"id":296244,"date":"2019-12-23T15:00:14","date_gmt":"2019-12-23T15:00:14","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=296244"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=296244","title":{"rendered":"\u041a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 SwiftLint Rules"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/481666\/\">\u041f\u0440\u0438\u0432\u0435\u0442, Habr! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u0435\u043a\u0441\u0435\u0439, \u044f iOS Developer \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 FINCH. \u0421\u043a\u043e\u0440\u043e \u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434 \u2014 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0436\u0438\u0442\u044c \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430 \u043a\u0430\u043a SwiftLint. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043f\u043e\u0447\u0435\u043c\u0443 \u0435\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f legacy \u0438 pet-\u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0432\u044b\u0436\u0430\u0442\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438. <br \/>  <a name=\"habracut\"><\/a><br \/>  \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 SwiftLint \u0438 \u043a\u0430\u043a \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u2014 \u0435\u0441\u043b\u0438 \u0432\u044b \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c\u044b \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c, \u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/github.com\/realm\/SwiftLint\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/a>.<\/p>\n<p>  \u041b\u0443\u0447\u0448\u0435 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0447\u0430\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u2014 \u043d\u0435\u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0439\u043b\u0433\u0430\u0439\u0434\u043e\u0432 \u043f\u043e\u0434 \u043f\u0440\u0438\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0445\u043e\u0442\u0444\u0438\u043a\u0441\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u043c. \u041d\u043e \u043f\u043e \u0444\u0430\u043a\u0442\u0443, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u0447\u0442\u0438\u0442\u0435 \u0441\u0442\u0430\u0439\u043b\u0433\u0430\u0439\u0434\u044b \u0438 \u0434\u0430\u0436\u0435 \u0432 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0442\u0440\u0435\u0437\u0432\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u0442\u044c, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0445\u043e\u0442\u044c \u0438 \u043d\u0435 \u043f\u043e\u0432\u043b\u0435\u0447\u0435\u0442 \u0437\u0430 \u0441\u043e\u0431\u043e\u0439 \u043f\u043e\u043b\u043e\u043c\u043a\u0443 \u043b\u043e\u0433\u0438\u043a\u0438, \u043d\u043e \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043d\u043e \u043f\u043e\u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u044d\u0441\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0443\u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0438\u0435. <\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c: <\/p>\n<p>  <b>1.<\/b> SwiftLint \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c:<\/p>\n<ul>\n<li> \u0415\u0434\u0438\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0441 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u0435\u043c \u0441\u0442\u0430\u0439\u043b\u0433\u0430\u0439\u0434\u043e\u0432<\/li>\n<\/ul>\n<p>  \u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435.<\/p>\n<p>  \u0421\u0442\u0430\u0442\u044c\u044f \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0442\u0430\u043a \u044f \u0431\u044b \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043d\u0430\u0447\u0430\u043b \u0431\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e. \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e SwiftLint <b>\u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c <\/b> \u2014 \u043f\u0438\u0441\u0430\u0442\u044c \u0433\u043e\u2026 \u0433\u043e\u0440\u044f\u0447\u0438\u0445 \u0444\u0438\u043a\u0441\u043e\u0432 \u043a\u043e\u0434. <\/p>\n<p>  <b>2.<\/b> SwiftLint \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0442\u044c:<\/p>\n<ul>\n<li> Force unwrap <\/li>\n<li> Strong delegates <\/li>\n<li> CyclomaticComplexity<\/li>\n<li> \u0427\u0442\u043e-\u0442\u043e \u0435\u0449\u0435\u2026 <\/li>\n<\/ul>\n<p>  \u0414\u0443\u043c\u0430\u044e, \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0431\u044b\u0442\u044c \u0437\u0430\u0441\u0442\u0440\u0430\u0445\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438? \u0414\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u044d\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0447\u0438\u0442\u0441\u044f \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0430\u043c\u0438 \u043d\u0435 \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u0432\u0430\u0435\u0442 \u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445.<\/p>\n<p>  <b>3.<\/b> Swiftlint \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043f\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0443 \u044f \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f final \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u0434\u0440\u0443\u0433\u0438\u043c. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f final \u043c\u044b \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u043c \u0432\u0440\u0435\u043c\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0412\u043e\u0442 \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043d\u0430\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f Apple \u043f\u0440\u043e final \u043a\u043b\u0430\u0441\u0441\u044b:   <\/p>\n<blockquote><p> Declarations with internal access (the default if nothing is declared) are only visible within the module where they are declared. Because Swift normally compiles the files that make up a module separately, the compiler cannot ascertain whether or not an internal declaration is overridden in a different file. However, if Whole Module Optimization is enabled, all of the module is compiled together at the same time. This allows the compiler to make inferences about the entire module together and infer final on declarations with internal if there are no visible overrides. <\/p><\/blockquote>\n<p>  \u0420\u0435\u0448\u0438\u043c \u043c\u044b \u0442\u0430\u043a\u0443\u044e \u043d\u0435\u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043a\u043e\u0439. \u0414\u0430\u043b\u0435\u0435 \u044f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0430 ruby, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u043c\u043e\u0433\u043b\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u043e\u0434 \u0441\u0440\u0430\u0437\u0443 \u0432 \u0441\u0432\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<pre><code class=\"ruby\">final_class:     included: &quot;.*.swift&quot;     name: &quot;Final class requrement&quot;     regex: '^class'     message: &quot;All classes must be final or nonfinal&quot;     saverity: error <\/code><\/pre>\n<p>  \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<pre><code class=\"swift\">class SomeClass { } \/\/ \u043e\u0448\u0438\u0431\u043a\u0430 internal class SomeClass { } \/\/ \u0432\u0435\u0440\u043d\u043e \/* @non-final *\/ class SomeClass { } \/\/ \u0442\u043e\u0436\u0435 \u0432\u0435\u0440\u043d\u043e <\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e required init. \u041c\u044b \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c UIView \u043a\u043b\u0430\u0441\u0441\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 NLView (NL \u2014 NibLess) \u2014 \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c required init \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437. \u041d\u043e\u0432\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u043e\u0433\u0443\u0442 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0442\u044c, \u043d\u043e \u0431\u043b\u0430\u0433\u043e SwiftLint \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043b\u0438\u0434\u0430. \u0418\u043b\u0438 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0438\u043c.<\/p>\n<pre><code class=\"ruby\">required_init:     regex: 'required init\\?\\(coder: NSCoder\\)'     message: &quot;Use NL class instead&quot; <\/code><\/pre>\n<p>   \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435\u0441\u044c \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u0430\u043c\u0438, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0447\u0442\u043e\u0431\u044b \u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u043f\u0440\u043e\u043f\u0435\u0440\u0442\u0438 \u0441\u0442\u043e\u0440\u0438\u0431\u043e\u0440\u0434\u043e\u0432 \u043f\u0440\u0438\u0432\u0430\u0442\u043d\u044b\u0435:<\/p>\n<pre><code class=\"ruby\">open_iboutlets:     included: &quot;.*.swift&quot;     name: &quot;IBOutlet opening&quot;     regex: '@IBOutlet ?(weak){0,1} var'     message: &quot;IBOutlet should be private&quot;     severity: error <\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"ruby\">open_ibaction:     included: &quot;.*.swift&quot;     name: &quot;IBAction opening&quot;     regex: '@IBAction func'     message: &quot;IBAction should be private&quot;     severity: error <\/code><\/pre>\n<p>   \u0427\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e Foundation \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043c, \u0433\u0434\u0435 \u043e\u043d \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u0441\u044f\u043a\u0438\u0439 \u0440\u0430\u0437 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c: <\/p>\n<pre><code class=\"ruby\"> foundation_using:     included: &quot;.*.swift&quot;     regex: 'import Foundation'     message: &quot;Do you really need for Foundation ???&quot;   <\/code><\/pre>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0441\u0435 \u0437\u043d\u0430\u044e\u0442 \u0447\u0442\u043e print \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u044f\u0436\u0435\u043b\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043c\u043e\u0436\u0435\u0442 \u0441\u0438\u043b\u044c\u043d\u043e \u043d\u0430\u0432\u0440\u0435\u0434\u0438\u0442\u044c \u043f\u0435\u0440\u0444\u043e\u043c\u0430\u043d\u0441\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f(\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0432 \u0446\u0438\u043a\u043b\u0430\u0445). \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u0435\u0440\u0434\u0438\u043a\u0442 \u2014 \u043f\u0440\u0438\u043d\u0442\u043e\u0432 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u043e\u0432\u0441\u0435\u043c. <\/p>\n<pre><code class=\"ruby\">print_using:     regex: 'print'     message: &quot;Print decrease performance of the app&quot;     severity: error <\/code><\/pre>\n<p>   \u0422\u0430\u043a\u0436\u0435 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c class only \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0441\u043a\u043e\u0440\u043e \u0441\u0442\u0430\u043d\u0435\u0442 deprecated \u0438 <a href=\"https:\/\/forums.swift.org\/t\/class-only-protocols-class-vs-anyobject\/11507\/11\">\u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 Swift<\/a>. <\/p>\n<pre><code class=\"ruby\">class_protocol:     regex: ': class'     message: &quot;Use Anyobject instead&quot;  <\/code><\/pre>\n<p>  \u041d\u0438\u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f R.swift. <\/p>\n<pre><code class=\"ruby\">image_name_initialization:     included: &quot;.*.swift&quot;     name: &quot;Image initialization without R.swift&quot;     regex: 'UIImage\\(named:[^)]+\\)'     message: &quot;Use R.image.name() or typealias of this instead&quot;     severity: error <\/code><\/pre>\n<p>   \u042d\u0442\u0430 \u043b\u0438\u0448\u044c \u043c\u0430\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u044f \u0441\u043c\u043e\u0433 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c, \u043d\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0435\u0449\u0435 \u043c\u0435\u043d\u044c\u0448\u0435. \u0412\u0441\u044e \u043c\u043e\u044e \u00ab\u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e\u00bb \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/smirnovaleksei\/CustomSwiftLintRules\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 github<\/a>. <\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0432\u044b \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 SwiftLint \u0441 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438, \u0442\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u043e \u043d\u0438\u0445 \u2014 \u0431\u0443\u0434\u0443 \u0440\u0430\u0434 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043a\u0435\u0439\u0441\u044b.<\/p><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d() } } }t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>      <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/481666\/\"> https:\/\/habr.com\/ru\/post\/481666\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/481666\/\">\u041f\u0440\u0438\u0432\u0435\u0442, Habr! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u043b\u0435\u043a\u0441\u0435\u0439, \u044f iOS Developer \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 FINCH. \u0421\u043a\u043e\u0440\u043e \u041d\u043e\u0432\u044b\u0439 \u0433\u043e\u0434 \u2014 \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u0436\u0438\u0442\u044c \u043f\u043e-\u0434\u0440\u0443\u0433\u043e\u043c\u0443, \u0430 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0430\u044f \u043a\u043b\u0430\u0441\u0441\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430 \u043a\u0430\u043a SwiftLint. \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043f\u043e\u0447\u0435\u043c\u0443 \u0435\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0432\u043e \u0432\u0441\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u044f legacy \u0438 pet-\u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0432\u044b\u0436\u0430\u0442\u044c \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-296244","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296244"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/296244\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}