Данная обработка является технологической и не предназначена для работы пользователя. В контексте обработки "Ядро" выполняется проверка объектов конфигурации.
3 |
--------------------------------------------------------------------------------
/src/Ext/HomePageWorkArea.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | OneColumn
4 |
5 |
6 |
7 | 10
8 |
9 | true
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Быстрая проверка кода для 1С:АПК
2 |
3 | Расширение для конфигурации 1С:Автоматизированная проверка конфигураций.
4 |
5 | Позволяет проверить произвольный текст кода. Работает в обычном приложении и в управляемом (тонкий и web-клиент). Базу с расширение можно опубликовать, веб-интерфейс выглядит так себе (у конфигурации режим совместимости интерфейса "Версия 8.2"), но если изменить его на "Такси", то будет выглядеть более лучше.
6 | [ Расскраска кода взята отсюда ](https://infostart.ru/public/994455/)
7 |
8 | ## Требования
9 | - Платформа **8.3.10** и выше.
10 | - 1С:Автоматизированная проверка конфигураций, редакция **1.2.5.16**.
11 |
12 | ## Установка
13 | - Создать расширение и загрузить в него конфигурацию из файлов.
14 |
15 | [ Публикация на Инфостарте ](http://infostart.ru/public/1027105/)
16 |
--------------------------------------------------------------------------------
/src/CommonModules/бпк_ПроверкаКодаПовтИсп/Ext/Module.bsl:
--------------------------------------------------------------------------------
1 | #Область СлужебныйПрограммныйИнтерфейс
2 |
3 | // Возвращает ссылку на стандарт.
4 | //
5 | // Параметры:
6 | // Ошибка - СправочникСсылка.ОбнаруживаемыеОшибки - Ошибка, описание которой нужно получить.
7 | //
8 | // Возвращаемое значение:
9 | // Строка - Ссылка на стандарт.
10 | //
11 | Функция ПолучитьОписаниеОшибки(Ошибка) Экспорт
12 |
13 | ОписаниеОшибки = Новый Структура("СсылкаНаСтандарт, Требование, ОписаниеТребования");
14 |
15 | Запрос = Новый Запрос;
16 | Запрос.УстановитьПараметр("Ошибка", Ошибка);
17 | Запрос.Текст =
18 | "ВЫБРАТЬ ПЕРВЫЕ 1
19 | | Требования.СсылкаНаСтандарт КАК СсылкаНаСтандарт,
20 | | Требования.Требование КАК Требование,
21 | | Требования.Требование.Представление КАК ОписаниеТребования
22 | |ИЗ
23 | | Справочник.ОбнаруживаемыеОшибки.Требования КАК Требования
24 | |ГДЕ
25 | | Требования.Ссылка = &Ошибка";
26 |
27 | Выборка = Запрос.Выполнить().Выбрать();
28 | Если Выборка.Следующий() Тогда
29 | ЗаполнитьЗначенияСвойств(ОписаниеОшибки, Выборка);
30 | КонецЕсли;
31 |
32 | Возврат ОписаниеОшибки;
33 |
34 | КонецФункции
35 |
36 | #КонецОбласти
--------------------------------------------------------------------------------
/src/Languages/Русский.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Русский
7 |
8 | Adopted
9 | ru
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/index.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | index
6 |
7 |
8 | ru
9 | Index
10 |
11 |
12 |
13 | TextDocument
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/theme_1c_css.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | theme_1c_css
6 |
7 |
8 | ru
9 | Theme 1c css
10 |
11 |
12 |
13 | TextDocument
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/mode_1c_1c_js.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | mode_1c_1c_js
6 |
7 |
8 | ru
9 | Код js для 1C
10 |
11 |
12 |
13 | TextDocument
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/lib_codemirror_js.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | lib_codemirror_js
6 |
7 |
8 | ru
9 | Lib codemirror js
10 |
11 |
12 |
13 | TextDocument
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/lib_codemirror_css.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | lib_codemirror_css
6 |
7 |
8 | ru
9 | Lib codemirror css
10 |
11 |
12 |
13 | TextDocument
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/addon_comment_comment_js.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | addon_comment_comment_js
6 |
7 |
8 | ru
9 | Addon comment comment js
10 |
11 |
12 |
13 | TextDocument
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/CommonPictures/бпк_ИТС.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | бпк_ИТС
6 |
7 |
8 | ru
9 | ИТС
10 |
11 |
12 |
13 | false
14 | false
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/CommonPictures/УровеньКритичностиОшибка.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | УровеньКритичностиОшибка
6 |
7 |
8 | ru
9 | Ошибка
10 |
11 |
12 |
13 | false
14 | false
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/CommonPictures/УровеньКритичностиРекомендация.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | УровеньКритичностиРекомендация
6 |
7 |
8 | ru
9 | Уровень критичности рекомендация
10 |
11 |
12 |
13 | false
14 | false
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Forms/ФормаУправляемая.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
22 |
--------------------------------------------------------------------------------
/src/CommonModules/бпк_ПроверкаКодаСервер.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | бпк_ПроверкаКодаСервер
6 |
7 |
8 | ru
9 | Бпк проверка кода сервер
10 |
11 |
12 |
13 | false
14 | false
15 | true
16 | true
17 | false
18 | false
19 | false
20 | DontUse
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/CommonModules/бпк_ПроверкаКодаПовтИсп.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | бпк_ПроверкаКодаПовтИсп
6 |
7 |
8 | ru
9 | Бпк проверка кода повт исп
10 |
11 |
12 |
13 | false
14 | false
15 | true
16 | true
17 | false
18 | false
19 | false
20 | DuringRequest
21 |
22 |
23 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/theme_1c_css/Ext/Template.txt:
--------------------------------------------------------------------------------
1 | /* 1c theme for codemirror */
2 |
3 | /**/
4 | .cm-s-1c.CodeMirror-scroll-1c :focus {
5 | /* overflow: scroll !important; /* Things will break if this is overridden */
6 | /* 30px is the magic margin used to hide the element's real scrollbars */
7 | /* See overflow: hidden in .CodeMirror */
8 | margin-bottom: 30px; margin-right: 30px;
9 | /*padding-bottom: 10px;*/
10 | height: 100%;
11 | outline: none; /* Prevent dragging from highlighting the element */
12 | position: relative;
13 | }
14 |
15 | /* Color scheme */
16 | .cm-s-1c.CodeMirror {
17 | /* Set height, width, borders, and global font properties here */
18 | font-family: monospace;
19 | height: 600px;
20 | /*color: gray;*/
21 | background-color:#ffffff;
22 | color:#2e383c;
23 | line-height:1.4375;
24 | }
25 |
26 | .cm-s-1c .cm-meta {color: #963200;}
27 | .cm-s-1c .cm-comment { color:#008000; }
28 | .cm-s-1c .cm-keyword, .cm-s-1c .cm-operator, .cm-s-1c .cm-delimiter, .cm-s-1c .cm-error { color:#ff0000; }
29 | .cm-s-1c .cm-variable,.cm-s-1c .cm-qualifier { color:#0000ff; }
30 | .cm-s-1c .cm-string,.cm-s-1c .cm-number { color:#000000; }
31 |
32 | .cm-s-1c .cm-atom { color:#75438a; }
33 | .cm-s-1c .cm-node,.cm-s-1c .cm-tag , .cm-s-1c .cm-property{ color:#9c3328; }
34 |
35 |
36 | /* Editor styling */
37 |
38 | .cm-s-1c pre {
39 | padding:0;
40 | }
41 |
42 | .cm-s-1c .CodeMirror-gutters {
43 | border:none;
44 | border-right:10px solid transparent;
45 | background-color:transparent;
46 | }
47 |
48 | .cm-s-1c .CodeMirror-linenumber {
49 | padding:0;
50 | color:#e0e2e5;
51 | }
52 |
53 | .cm-s-1c .CodeMirror-guttermarker { color: #1d75b3; }
54 | .cm-s-1c .CodeMirror-guttermarker-subtle { color: #e0e2e5; }
55 |
56 | .cm-s-1c .CodeMirror-cursor {
57 | border-left: 1px solid black;
58 | border-right: none;
59 | width: 0;
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/src/Enums/ТипыОбъектов.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 2ad2e1af-1940-40af-a783-97364f126ae9
7 | 8a3d037f-501e-4c34-891d-aa1078cd09aa
8 |
9 |
10 | 5afdf8b5-5cb7-48c5-b6c8-0b052025503f
11 | 326f0b06-2aea-4666-9ab4-dbc5bb3e2cb8
12 |
13 |
14 | 60c68743-f449-46f1-899b-0b990e62f77b
15 | f75e65f5-be9d-461e-8551-e946320b4ae0
16 |
17 |
18 |
19 | ТипыОбъектов
20 |
21 | Adopted
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/Catalogs/Правила.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 912f2c03-01c9-4e7e-97a8-0087be4b0d2d
7 | 97867a1c-9495-482c-b040-a55a0289f0a1
8 |
9 |
10 | e02c1abe-83e7-4324-affe-01be222f2475
11 | 2fc5c03b-44a2-4b1f-930f-1b98b327aa20
12 |
13 |
14 | d6fb5300-e167-4521-957f-5e915fe6e5b5
15 | 382bce6f-5846-47c9-a644-7ba8cf7c0f80
16 |
17 |
18 | 83617201-b4ab-4a0f-9c35-1855bfe9ab54
19 | 8f281aa8-2a69-41b8-acb8-9b4048dbbbf9
20 |
21 |
22 | 12847b2f-2c88-44ec-b9a0-8e699d1a7d53
23 | cd72bd42-1d8d-40a0-bd29-d196f5690e39
24 |
25 |
26 |
27 | Правила
28 |
29 | Adopted
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/Catalogs/Требования.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | f57ca2ce-7a0d-4ed9-ad99-902e250e4a67
7 | 746232ca-462b-4377-adc1-1577184f1081
8 |
9 |
10 | b0db9674-3775-4e65-b79e-5ef36954132b
11 | e591ad84-144d-4d9d-b888-b8fa1e01b8eb
12 |
13 |
14 | b720457b-5476-4a5c-b200-440f44c7153c
15 | 6228fd33-633b-46bb-aca2-8f58b90bdd98
16 |
17 |
18 | 3929382e-2a1e-46d8-b73e-7edcbf8d9a4e
19 | c789c705-4355-4f21-b879-d7ff69345fd2
20 |
21 |
22 | 0009f97d-c44d-4398-b15b-a38c86810619
23 | 3a7bf6e3-773e-45b7-a1c0-d9074b84ed9a
24 |
25 |
26 |
27 | Требования
28 |
29 | Adopted
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/index/Ext/Template.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | CodeMirror 1C
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
56 |
57 |
--------------------------------------------------------------------------------
/src/Catalogs/ОбнаруживаемыеОшибки.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 26493b84-dec5-44f4-8929-1aa07a948db0
7 | 43199f68-6a56-4127-81af-d8e7022fd8f1
8 |
9 |
10 | aca7e9ec-3139-48e0-98ac-12ac5f3bf33e
11 | d7ae728f-40ab-4d28-81d4-f6d35a7fa967
12 |
13 |
14 | 61b0a59c-2393-42bf-b1ab-4f0d9f9e8425
15 | 4120752b-32f9-4564-8dac-8e07870d3eb0
16 |
17 |
18 | 644639ee-a0b3-4fee-906b-476519d7cdce
19 | 15c27083-3798-4d65-b4c2-7b0db26367a5
20 |
21 |
22 | 8d659895-8722-4eac-b76f-e51dc7ebf62f
23 | d2dbc544-a975-4b81-9147-41ff4721c340
24 |
25 |
26 |
27 | ОбнаруживаемыеОшибки
28 |
29 | Adopted
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 41b79969-354a-42ed-9909-29daa5b6311a
7 | f3e77aa8-c228-4159-8a5a-7651327f821a
8 |
9 |
10 | 84a0dbce-e090-47b9-ac47-02bd8e35f1b7
11 | edd6945e-345f-43d7-af04-23f1d526b901
12 |
13 |
14 |
15 | ПроверкаКода
16 |
17 |
18 | ru
19 | Проверка кода
20 |
21 |
22 |
23 | false
24 | DataProcessor.ПроверкаКода.Form.ФормаУправляемая
25 | DataProcessor.ПроверкаКода.Form.ФормаУправляемая
26 | false
27 |
28 |
29 |
30 |
31 |
32 | index
33 | lib_codemirror_js
34 | lib_codemirror_css
35 | mode_1c_1c_js
36 | theme_1c_css
37 | addon_comment_comment_js
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/DataProcessors/ЯдроПроверкиКода.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 6e195a0f-1369-4f66-b13a-d720e4a8492e
7 | faabc773-802f-4853-99b7-3e87fbd7f2cb
8 |
9 |
10 | 9e845c11-af48-4704-b895-101ceeda4053
11 | 546e7f25-47ea-478d-953d-c5b9c39bc23e
12 |
13 |
14 |
15 | ЯдроПроверкиКода
16 |
17 |
18 | ru
19 | Ядро проверки кода
20 |
21 |
22 |
23 | false
24 |
25 |
26 | false
27 |
28 |
29 |
30 |
31 |
32 |
33 | Версия
34 |
35 |
36 | ru
37 | Версия
38 |
39 |
40 |
41 |
42 | xs:string
43 |
44 | 10
45 | Variable
46 |
47 |
48 | false
49 |
50 |
51 |
52 | false
53 |
54 | false
55 | false
56 |
57 |
58 | DontCheck
59 | Items
60 |
61 |
62 | Auto
63 | Auto
64 |
65 |
66 | Auto
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/src/Configuration.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 9cd510cd-abfc-11d4-9434-004095e12fc7
7 | a6f3ed97-0608-44ff-b030-aabef2ce169f
8 |
9 |
10 | 9fcd25a0-4822-11d4-9414-008048da11f9
11 | 487647dc-6827-4ee1-be2b-3ccfc24a41f9
12 |
13 |
14 | e3687481-0a87-462c-a166-9f34594f9bba
15 | e8142caa-f606-4e08-a456-e1cf58318478
16 |
17 |
18 | 9de14907-ec23-4a07-96f0-85521cb6b53b
19 | 3af897b2-b9b2-4469-aa92-e5df4d892703
20 |
21 |
22 | 51f2d5d8-ea4d-4064-8892-82951750031e
23 | cdf0b382-e557-460e-bfce-e4122a96d0f3
24 |
25 |
26 | e68182ea-4237-4383-967f-90c1e3370bc7
27 | d030b940-b042-4072-94ee-b801bebef27c
28 |
29 |
30 |
31 | БыстраяПроверкаКода
32 |
33 |
34 | ru
35 | Быстрая проверка кода
36 |
37 |
38 |
39 | Customization
40 | Adopted
41 | true
42 | бпк_
43 | Version8_3_10
44 |
45 | PlatformApplication
46 |
47 | Russian
48 | Ипатов Николай
49 | 1.2.5.16
50 |
51 |
52 |
53 |
54 | ru
55 | Ипатов Николай
56 |
57 |
58 |
59 |
60 |
61 |
62 | Русский
63 | УровеньКритичностиРекомендация
64 | УровеньКритичностиОшибка
65 | бпк_ИТС
66 | бпк_ПроверкаКодаСервер
67 | бпк_ПроверкаКодаПовтИсп
68 | Требования
69 | ОбнаруживаемыеОшибки
70 | Правила
71 | ТипыОбъектов
72 | ЯдроПроверкиКода
73 | ПроверкаКода
74 |
75 |
76 |
--------------------------------------------------------------------------------
/src/CommonModules/бпк_ПроверкаКодаСервер/Ext/Module.bsl:
--------------------------------------------------------------------------------
1 | #Область ПрограммныйИнтерфейс
2 |
3 | // Запускает проверку кода и формирует результат проверки.
4 | //
5 | // Параметры:
6 | // ПараметрыПроверки - Структура - См. ПараметрыПроверки().
7 | // АдресРезультата - Строка - Адрес во временном хранилище, куда будет помещен результат выполнения.
8 | //
9 | Процедура ПроверитьКод(ПараметрыПроверки, АдресРезультата) Экспорт
10 |
11 | ВыполнитьПроверкуКода(ПараметрыПроверки);
12 |
13 | Результат = Новый Структура;
14 | Результат.Вставить("Ошибки", ПараметрыПроверки.Ошибки);
15 | Результат.Вставить("КоличествоОшибок", ПараметрыПроверки.КоличествоОшибок);
16 |
17 | ПоместитьВоВременноеХранилище(Результат, АдресРезультата);
18 |
19 | КонецПроцедуры
20 |
21 | // Функция-конструктор для параметров проверки кода.
22 | //
23 | // Возвращаемое значение:
24 | // Структура - Данные ошибки.
25 | // * ТекстМодуля - Строка - Содержит текст модуля.
26 | // * ТипОбъекта - ПеречислениеСсылка.ТипыОбъектов - Тип объекта метаданных.
27 | // * Свойства - Структура - Свойства объекта.
28 | // * Требования - Массив - Содержит массив требований.
29 | // * СоставМодулей - Массив - Состав модулей.
30 | //
31 | Функция ПараметрыПроверки() Экспорт
32 |
33 | ПараметрыПроверки = Новый Структура;
34 |
35 | СоставМодулей = Новый Массив;
36 | СоставМодулей.Добавить(Перечисления.ИдентификаторыСодержанияОбъектов.Модуль);
37 |
38 | ПараметрыПроверки.Вставить("СоставМодулей", СоставМодулей);
39 | ПараметрыПроверки.Вставить("ТипОбъекта", Перечисления.ТипыОбъектов.ПустаяСсылка());
40 | ПараметрыПроверки.Вставить("Требования", Новый Массив);
41 | ПараметрыПроверки.Вставить("ТекстМодуля", "");
42 | ПараметрыПроверки.Вставить("Свойства", Новый Структура);
43 |
44 | Возврат ПараметрыПроверки;
45 |
46 | КонецФункции
47 |
48 | // Возвращает список типов объектов метаданных для проверки.
49 | //
50 | // Возвращаемое значение:
51 | // СписокЗначений - Список типов объектов.
52 | //
53 | Функция ТипыОбъектовДляПроверки() Экспорт
54 |
55 | Модули = Новый СписокЗначений;
56 |
57 | Модули.Добавить(Перечисления.ТипыОбъектов.Конфигурация, "Модуль обычного приложения");
58 | Модули.Добавить(Перечисления.ТипыОбъектов.Конфигурация, "Модуль управляемого приложения");
59 | Модули.Добавить(Перечисления.ТипыОбъектов.Конфигурация, "Модуль внешнего соединения");
60 | Модули.Добавить(Перечисления.ТипыОбъектов.Конфигурация, "Модуль сеанса");
61 | Модули.Добавить(Перечисления.ТипыОбъектов.ОбщийМодуль, "Общий модуль");
62 | Модули.Добавить(Перечисления.ТипыОбъектов.УправляемаяФорма, "Модуль управляемой формы");
63 | Модули.Добавить(Перечисления.ТипыОбъектов.Форма, "Модуль обычной формы");
64 | Модули.Добавить(Перечисления.ТипыОбъектов.Команда, "Модуль команды");
65 | Модули.Добавить(Перечисления.ТипыОбъектов.Справочник, "Модуль объекта");
66 | Модули.Добавить(Перечисления.ТипыОбъектов.Справочник, "Модуль менеджера");
67 | Модули.Добавить(Перечисления.ТипыОбъектов.РегистрСведений, "Модуль набора записей");
68 |
69 | Возврат Модули;
70 |
71 | КонецФункции
72 |
73 | #КонецОбласти
74 |
75 | #Область СлужебныеПроцедурыИФункции
76 |
77 | // Возвращает коллекцию регистрируемых ошибок.
78 | //
79 | // Параметры:
80 | // Требования - Массив - Требования, по которым необходимо вернуть ошибки.
81 | //
82 | // Возвращаемое значение:
83 | // Соответствие - Соответствие регистрируемых ошибкок.
84 | // * Ключ - СправочникСсылка.ОбнаруживаемыеОшибки.
85 | //
86 | Функция РегистрируемыеОшибки(Требования)
87 |
88 | РегистрируемыеОшибки = Новый Соответствие;
89 |
90 | Запрос = Новый Запрос;
91 | Запрос.УстановитьПараметр("Требования", Требования);
92 | Запрос.Текст =
93 | "ВЫБРАТЬ
94 | | ТребованияРеализацияТребования.ПравилоПроверки КАК ПравилоПроверки
95 | |ПОМЕСТИТЬ ВтПравила
96 | |ИЗ
97 | | Справочник.Требования.РеализацияТребования КАК ТребованияРеализацияТребования
98 | |ГДЕ
99 | | ТребованияРеализацияТребования.Ссылка В(&Требования)
100 | |;
101 | |
102 | |////////////////////////////////////////////////////////////////////////////////
103 | |ВЫБРАТЬ
104 | | ПравилаОбнаруживаемыеОшибки.Ошибка КАК Ошибка
105 | |ИЗ
106 | | ВтПравила КАК ВтПравила
107 | | ВНУТРЕННЕЕ СОЕДИНЕНИЕ Справочник.Правила.ОбнаруживаемыеОшибки КАК ПравилаОбнаруживаемыеОшибки
108 | | ПО ВтПравила.ПравилоПроверки = ПравилаОбнаруживаемыеОшибки.Ссылка";
109 |
110 | Выборка = Запрос.Выполнить().Выбрать();
111 |
112 | Пока Выборка.Следующий() Цикл
113 | РегистрируемыеОшибки.Вставить(Выборка.Ошибка, Истина);
114 | КонецЦикла;
115 |
116 | Возврат РегистрируемыеОшибки;
117 |
118 | КонецФункции
119 |
120 | Процедура ВыполнитьПроверкуКода(Параметры)
121 |
122 | РегистрируемыеОшибки = РегистрируемыеОшибки(Параметры.Требования);
123 |
124 | // Инициализируем ядро для проверки.
125 | Ядро = Обработки.ЯдроПроверкиКода.Создать();
126 | Ядро.УстановитьРегистрациюВТаблицу();
127 | Ядро.УстановитьМаксимальноеКоличествоОшибокОдногоВида(10000);
128 | Ядро.СоответствиеРегистрируемыхОшибок = РегистрируемыеОшибки;
129 | Ядро.Переопределяемый_ЗаполнитьТаблицуИсключенийИзПроверки();
130 |
131 | Ядро.ПараметрыПроверкиКода = Параметры;
132 | Ядро.ЭтоПроверкаКода = Истина;
133 | Ядро.УстановитьКонтекстМодуля();
134 | Ядро.УстановитьКонтекстРасширения(Неопределено);
135 |
136 | Ядро.ПроверитьКод();
137 |
138 | Ядро.ЗавершитьПроверку();
139 | ДанныеОшибок = Ядро.ПолучитьНайденныеОшибки();
140 | СоответствиеПроверенныхОбъектовИПравил = Ядро.СоответствиеПроверенныхОбъектовИПравил;
141 | СоответствиеОшибок = Ядро.ПолучитьСоответствиеОбнаруженныхОшибокИИхКоличества();
142 | Ядро = Неопределено;
143 |
144 | Параметры.Вставить("ОшибкиПоСтрокам", ДанныеОшибок.ОшибкиПоСтрокам);
145 | Параметры.Вставить("КоличествоОшибок", ДанныеОшибок.КоличествоОшибок);
146 | Параметры.Вставить("Ошибки", ДанныеОшибок.Ошибки);
147 |
148 | КонецПроцедуры
149 |
150 | #КонецОбласти
--------------------------------------------------------------------------------
/src/ConfigDumpInfo.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Ext/ObjectModule.bsl:
--------------------------------------------------------------------------------
1 |
2 | #Область ПрограммныйИнтерфейс
3 |
4 | // Возвращает таблицу блоков переданного типа модуля объекта конфигурации.
5 | // Если проверяемый объект не имеет указанного типа модуля, то возвращается "Неопределено".
6 | //
7 | // Параметры:
8 | // ИмяМодуля - ПеречислениеСсылка.ИдентификаторыСодержанияОбъектов - тип модуля объекта.
9 | // ОбъектКонфигурации - СправочникСсылка.СтруктураКонфигурации, Неопределено - ссылка на объект.
10 | // Если не заполнен, то возвращается текст модуля текущего проверяемого объекта.
11 | //
12 | // Возвращаемое значение:
13 | // Неопределено, ТаблицаЗначений - таблица блоков модуля объекта с колонками:
14 | // Блок - ПеречислениеСсылка.ТипыБлоковМодулей - тип блока модуля.
15 | // НачальнаяСтрока - Число - номер строки начала блока.
16 | // КонечнаяСтрока - Число - номер строки окончания блока.
17 | // ЕстьКомментарий - Булево - флаг наличия комментария в блоке.
18 | // ЕстьЭкспорт - Булево - флаг наличия экспорта в блоке,
19 | // актуально для заголовков процедур и функций.
20 | // Текст - Строка - многострочный текст блока.
21 | //
22 | Функция ПолучитьТаблицуБлоковМодуля(Знач ТекстМодуля) Экспорт
23 |
24 | ТипыБлоков = Перечисления.ТипыБлоковМодулей;
25 |
26 | ТаблицаБлоков = Новый ТаблицаЗначений;
27 | ТаблицаБлоков.Колонки.Добавить("Блок");
28 | ТаблицаБлоков.Колонки.Добавить("НачальнаяСтрока");
29 | ТаблицаБлоков.Колонки.Добавить("КонечнаяСтрока");
30 | ТаблицаБлоков.Колонки.Добавить("ЕстьКомментарий");
31 | ТаблицаБлоков.Колонки.Добавить("ЕстьЭкспорт");
32 | ТаблицаБлоков.Колонки.Добавить("ДирективаКомпиляции");
33 | ТаблицаБлоков.Колонки.Добавить("Текст");
34 |
35 | Текст = Новый ТекстовыйДокумент;
36 | Текст.УстановитьТекст(ТекстМодуля);
37 | ВсегоСтрокМодуля = Текст.КоличествоСтрок();
38 |
39 | // Разбиваем текст модуля на блоки.
40 | ТекущийБлок = Неопределено;
41 | НачальнаяСтрока = 1;
42 | КонечнаяСтрока = 1;
43 | ЭтоКонецБлока = Истина;
44 | ЕстьЭкспорт = Неопределено;
45 | ЕстьКомментарий = Ложь;
46 | ДирективаКомпиляции = "";
47 |
48 | Для НомерСтроки = 1 По ВсегоСтрокМодуля Цикл
49 |
50 | СтрокаМодуляИсходная = Текст.ПолучитьСтроку(НомерСтроки);
51 | СтрокаМодуля = СокрЛП(СтрокаМодуляИсходная);
52 | СтрокаМодуля = ВРег(СтрокаМодуля);
53 |
54 | // Встретился случай неправильного определения процедуры:
55 | // ПроцедураПроверки = Обработчик.ПроцедураПроверки;
56 | // Замена происходит для правильного определения блока, в функцию СтрНачинаетсяС() добавлены пробелы в строку поиска.
57 |
58 | // Для случаев "КонецФункции" и "КонецПроцедуры" пробелы не добавляем.
59 | // Встретился случай неправильного определения окончания функции:
60 | // КонецФункции// СформироватьЗапросПроверкиПриСменеСтатуса();
61 |
62 | СтрокаМодуля = СтрЗаменить(СтрокаМодуля, Символы.Таб, " ") + " ";
63 |
64 | Если НЕ ЭтоКонецБлока Тогда
65 | НовыйБлок = ТекущийБлок;
66 | Если НовыйБлок = ТипыБлоков.ОписаниеПеременной Тогда
67 | ЭтоКонецБлока = (СтрНайти(СтрокаМодуля, ";") > 0);
68 | ИначеЕсли НовыйБлок = ТипыБлоков.ЗаголовокПроцедуры
69 | ИЛИ НовыйБлок = ТипыБлоков.ЗаголовокФункции Тогда
70 |
71 | ПозицияСкобки = (СтрНайти(СтрокаМодуля, ")") > 0);
72 | ЭтоКонецБлока = (ПозицияСкобки > 0);
73 | ЕстьЭкспорт = Ложь;
74 | Если ЭтоКонецБлока Тогда
75 | ПозицияКомментария = СтрНайти(СтрокаМодуля, "//", , ПозицияСкобки);
76 | Если ПозицияКомментария > 0 Тогда
77 | СтрокаМодуля = СокрП(Лев(СтрокаМодуля, ПозицияКомментария - 1));
78 | КонецЕсли;
79 | ЕстьЭкспорт = (СтрНайти(СтрокаМодуля, "ЭКСПОРТ", , ПозицияСкобки) > 0);
80 | КонецЕсли;
81 | Иначе
82 | ЭтоКонецБлока = Истина;
83 | КонецЕсли;
84 | ИначеЕсли СтрНачинаетсяС(СтрокаМодуля, "//") Тогда
85 | НовыйБлок = ТипыБлоков.Комментарий;
86 | ЭтоКонецБлока = Истина;
87 | ИначеЕсли СтрНачинаетсяС(СтрокаМодуля, "ПЕРЕМ ") Тогда
88 | НовыйБлок = ТипыБлоков.ОписаниеПеременной;
89 | ЭтоКонецБлока = (СтрНайти(СтрокаМодуля, ";") > 0);
90 | ИначеЕсли СтрНачинаетсяС(СтрокаМодуля, "ПРОЦЕДУРА ") Тогда
91 | НовыйБлок = ТипыБлоков.ЗаголовокПроцедуры;
92 | ЕстьЭкспорт = Ложь;
93 |
94 | ПозицияСкобки = СтрНайти(СтрокаМодуля, ")");
95 | ЭтоКонецБлока = ПозицияСкобки > 0;
96 | Если ЭтоКонецБлока Тогда
97 | ПозицияКомментария = СтрНайти(СтрокаМодуля, "//", , ПозицияСкобки);
98 | Если ПозицияКомментария > 0 Тогда
99 | СтрокаМодуля = СокрП(Лев(СтрокаМодуля, ПозицияКомментария - 1));
100 | КонецЕсли;
101 | ЕстьЭкспорт = СтрНайти(СтрокаМодуля, "ЭКСПОРТ", , ПозицияСкобки) > 0;
102 | КонецЕсли;
103 | ИначеЕсли СтрНачинаетсяС(СтрокаМодуля, "КОНЕЦПРОЦЕДУРЫ") Тогда // пробел не добавляем (см. выше)
104 | НовыйБлок = ТипыБлоков.ОкончаниеПроцедуры;
105 | ЭтоКонецБлока = Истина;
106 | ИначеЕсли СтрНачинаетсяС(СтрокаМодуля, "ФУНКЦИЯ ") Тогда
107 | НовыйБлок = ТипыБлоков.ЗаголовокФункции;
108 | ЕстьЭкспорт = Ложь;
109 |
110 | ПозицияСкобки = СтрНайти(СтрокаМодуля, ")");
111 | ЭтоКонецБлока = ПозицияСкобки > 0;
112 | Если ЭтоКонецБлока Тогда
113 | ПозицияКомментария = СтрНайти(СтрокаМодуля, "//", , ПозицияСкобки);
114 | Если ПозицияКомментария > 0 Тогда
115 | СтрокаМодуля = СокрП(Лев(СтрокаМодуля, ПозицияКомментария - 1));
116 | КонецЕсли;
117 | ЕстьЭкспорт = (СтрНайти(СтрокаМодуля, "ЭКСПОРТ", , ПозицияСкобки) > 0);
118 | КонецЕсли;
119 | ИначеЕсли СтрНачинаетсяС(СтрокаМодуля, "КОНЕЦФУНКЦИИ") Тогда // пробел не добавляем (см. выше)
120 | НовыйБлок = ТипыБлоков.ОкончаниеФункции;
121 | ЭтоКонецБлока = Истина;
122 | Иначе
123 | НовыйБлок = ТипыБлоков.Операторы;
124 | ЭтоКонецБлока = Истина;
125 |
126 | Если СтрНачинаетсяС(СтрокаМодуля, "&") Тогда
127 | ДирективаКомпиляции = СтрокаМодуляИсходная;
128 | КонецЕсли;
129 | КонецЕсли;
130 |
131 | Если НовыйБлок = ТекущийБлок Тогда
132 | ЕстьКомментарий = (ЕстьКомментарий ИЛИ (СтрНайти(СтрокаМодуля, "//") > 0));
133 | КонечнаяСтрока = КонечнаяСтрока + 1;
134 | Иначе
135 |
136 | Если ЗначениеЗаполнено(ТекущийБлок) Тогда
137 |
138 | НоваяЗаписьОБлоке = ТаблицаБлоков.Добавить();
139 | НоваяЗаписьОБлоке.Блок = ТекущийБлок;
140 | НоваяЗаписьОБлоке.ЕстьКомментарий = ЕстьКомментарий;
141 | НоваяЗаписьОБлоке.НачальнаяСтрока = НачальнаяСтрока;
142 | НоваяЗаписьОБлоке.КонечнаяСтрока = КонечнаяСтрока;
143 |
144 | ЭтоМетод = (ТекущийБлок = ТипыБлоков.ЗаголовокПроцедуры) ИЛИ (ТекущийБлок = ТипыБлоков.ЗаголовокФункции);
145 | Если ЭтоМетод Тогда
146 | НоваяЗаписьОБлоке.ЕстьЭкспорт = ЕстьЭкспорт;
147 | КонецЕсли;
148 |
149 | ЭтоПеременная = (ТекущийБлок = ТипыБлоков.ОписаниеПеременной);
150 | Если ЭтоМетод ИЛИ ЭтоПеременная Тогда
151 | НоваяЗаписьОБлоке.ДирективаКомпиляции = ДирективаКомпиляции;
152 | ДирективаКомпиляции = "";
153 | КонецЕсли;
154 |
155 | КонецЕсли;
156 |
157 | НачальнаяСтрока = НомерСтроки;
158 | КонечнаяСтрока = НомерСтроки;
159 | ТекущийБлок = НовыйБлок;
160 | ЕстьКомментарий = (СтрНайти(СтрокаМодуляИсходная, "//") > 0);
161 |
162 | КонецЕсли;
163 |
164 | Если НомерСтроки = ВсегоСтрокМодуля Тогда
165 |
166 | НоваяЗаписьОБлоке = ТаблицаБлоков.Добавить();
167 | НоваяЗаписьОБлоке.Блок = ТекущийБлок;
168 | НоваяЗаписьОБлоке.ЕстьКомментарий = ЕстьКомментарий;
169 | НоваяЗаписьОБлоке.НачальнаяСтрока = НачальнаяСтрока;
170 | НоваяЗаписьОБлоке.КонечнаяСтрока = КонечнаяСтрока;
171 |
172 | ЭтоМетод = (ТекущийБлок = ТипыБлоков.ЗаголовокПроцедуры) ИЛИ (ТекущийБлок = ТипыБлоков.ЗаголовокФункции);
173 | Если ЭтоМетод Тогда
174 | НоваяЗаписьОБлоке.ЕстьЭкспорт = ЕстьЭкспорт;
175 | КонецЕсли;
176 |
177 | ЭтоПеременная = (ТекущийБлок = ТипыБлоков.ОписаниеПеременной);
178 | Если ЭтоМетод ИЛИ ЭтоПеременная Тогда
179 | НоваяЗаписьОБлоке.ДирективаКомпиляции = ДирективаКомпиляции;
180 | ДирективаКомпиляции = "";
181 | КонецЕсли;
182 |
183 | КонецЕсли;
184 |
185 | КонецЦикла;
186 |
187 | // Заполняем структуру модуля текстом.
188 | РазборТекста = Новый ТекстовыйДокумент;
189 | РазборТекста.УстановитьТекст(ТекстМодуля);
190 |
191 | Для Каждого СтрокаБлока Из ТаблицаБлоков Цикл
192 |
193 | ТекстБлока = Новый ТекстовыйДокумент;
194 |
195 | Для Счетчик = СтрокаБлока.НачальнаяСтрока По СтрокаБлока.КонечнаяСтрока Цикл
196 | ТекстБлока.ДобавитьСтроку(РазборТекста.ПолучитьСтроку(Счетчик));
197 | КонецЦикла;
198 |
199 | СтрокаБлока.Текст = ТекстБлока.ПолучитьТекст();
200 |
201 | КонецЦикла;
202 |
203 | Возврат ТаблицаБлоков;
204 |
205 | КонецФункции
206 |
207 | #КонецОбласти
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/addon_comment_comment_js/Ext/Template.txt:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // Distributed under an MIT license: http://codemirror.net/LICENSE
3 |
4 | (function(mod) {
5 | if (typeof exports == "object" && typeof module == "object") // CommonJS
6 | mod(require("../../lib/codemirror"));
7 | else if (typeof define == "function" && define.amd) // AMD
8 | define(["../../lib/codemirror"], mod);
9 | else // Plain browser env
10 | mod(CodeMirror);
11 | })(function(CodeMirror) {
12 | "use strict";
13 |
14 | var noOptions = {};
15 | var nonWS = /[^\s\u00a0]/;
16 | var Pos = CodeMirror.Pos;
17 |
18 | function firstNonWS(str) {
19 | var found = str.search(nonWS);
20 | return found == -1 ? 0 : found;
21 | }
22 |
23 | CodeMirror.commands.toggleComment = function(cm) {
24 | cm.toggleComment();
25 | };
26 |
27 | CodeMirror.defineExtension("toggleComment", function(options) {
28 | if (!options) options = noOptions;
29 | var cm = this;
30 | var minLine = Infinity, ranges = this.listSelections(), mode = null;
31 | for (var i = ranges.length - 1; i >= 0; i--) {
32 | var from = ranges[i].from(), to = ranges[i].to();
33 | if (from.line >= minLine) continue;
34 | if (to.line >= minLine) to = Pos(minLine, 0);
35 | minLine = from.line;
36 | if (mode == null) {
37 | if (cm.uncomment(from, to, options)) mode = "un";
38 | else { cm.lineComment(from, to, options); mode = "line"; }
39 | } else if (mode == "un") {
40 | cm.uncomment(from, to, options);
41 | } else {
42 | cm.lineComment(from, to, options);
43 | }
44 | }
45 | });
46 |
47 | // Rough heuristic to try and detect lines that are part of multi-line string
48 | function probablyInsideString(cm, pos, line) {
49 | return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line)
50 | }
51 |
52 | CodeMirror.defineExtension("lineComment", function(from, to, options) {
53 | if (!options) options = noOptions;
54 | var self = this, mode = self.getModeAt(from);
55 | var firstLine = self.getLine(from.line);
56 | if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
57 |
58 | var commentString = options.lineComment || mode.lineComment;
59 | if (!commentString) {
60 | if (options.blockCommentStart || mode.blockCommentStart) {
61 | options.fullLines = true;
62 | self.blockComment(from, to, options);
63 | }
64 | return;
65 | }
66 |
67 | var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
68 | var pad = options.padding == null ? " " : options.padding;
69 | var blankLines = options.commentBlankLines || from.line == to.line;
70 |
71 | self.operation(function() {
72 | if (options.indent) {
73 | var baseString = null;
74 | for (var i = from.line; i < end; ++i) {
75 | var line = self.getLine(i);
76 | var whitespace = line.slice(0, firstNonWS(line));
77 | if (baseString == null || baseString.length > whitespace.length) {
78 | baseString = whitespace;
79 | }
80 | }
81 | for (var i = from.line; i < end; ++i) {
82 | var line = self.getLine(i), cut = baseString.length;
83 | if (!blankLines && !nonWS.test(line)) continue;
84 | if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
85 | self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
86 | }
87 | } else {
88 | for (var i = from.line; i < end; ++i) {
89 | if (blankLines || nonWS.test(self.getLine(i)))
90 | self.replaceRange(commentString + pad, Pos(i, 0));
91 | }
92 | }
93 | });
94 | });
95 |
96 | CodeMirror.defineExtension("blockComment", function(from, to, options) {
97 | if (!options) options = noOptions;
98 | var self = this, mode = self.getModeAt(from);
99 | var startString = options.blockCommentStart || mode.blockCommentStart;
100 | var endString = options.blockCommentEnd || mode.blockCommentEnd;
101 | if (!startString || !endString) {
102 | if ((options.lineComment || mode.lineComment) && options.fullLines != false)
103 | self.lineComment(from, to, options);
104 | return;
105 | }
106 | if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
107 |
108 | var end = Math.min(to.line, self.lastLine());
109 | if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
110 |
111 | var pad = options.padding == null ? " " : options.padding;
112 | if (from.line > end) return;
113 |
114 | self.operation(function() {
115 | if (options.fullLines != false) {
116 | var lastLineHasText = nonWS.test(self.getLine(end));
117 | self.replaceRange(pad + endString, Pos(end));
118 | self.replaceRange(startString + pad, Pos(from.line, 0));
119 | var lead = options.blockCommentLead || mode.blockCommentLead;
120 | if (lead != null) for (var i = from.line + 1; i <= end; ++i)
121 | if (i != end || lastLineHasText)
122 | self.replaceRange(lead + pad, Pos(i, 0));
123 | } else {
124 | self.replaceRange(endString, to);
125 | self.replaceRange(startString, from);
126 | }
127 | });
128 | });
129 |
130 | CodeMirror.defineExtension("uncomment", function(from, to, options) {
131 | if (!options) options = noOptions;
132 | var self = this, mode = self.getModeAt(from);
133 | var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
134 |
135 | // Try finding line comments
136 | var lineString = options.lineComment || mode.lineComment, lines = [];
137 | var pad = options.padding == null ? " " : options.padding, didSomething;
138 | lineComment: {
139 | if (!lineString) break lineComment;
140 | for (var i = start; i <= end; ++i) {
141 | var line = self.getLine(i);
142 | var found = line.indexOf(lineString);
143 | if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
144 | if (found == -1 && nonWS.test(line)) break lineComment;
145 | if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
146 | lines.push(line);
147 | }
148 | self.operation(function() {
149 | for (var i = start; i <= end; ++i) {
150 | var line = lines[i - start];
151 | var pos = line.indexOf(lineString), endPos = pos + lineString.length;
152 | if (pos < 0) continue;
153 | if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
154 | didSomething = true;
155 | self.replaceRange("", Pos(i, pos), Pos(i, endPos));
156 | }
157 | });
158 | if (didSomething) return true;
159 | }
160 |
161 | // Try block comments
162 | var startString = options.blockCommentStart || mode.blockCommentStart;
163 | var endString = options.blockCommentEnd || mode.blockCommentEnd;
164 | if (!startString || !endString) return false;
165 | var lead = options.blockCommentLead || mode.blockCommentLead;
166 | var startLine = self.getLine(start), open = startLine.indexOf(startString)
167 | if (open == -1) return false
168 | var endLine = end == start ? startLine : self.getLine(end)
169 | var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
170 | if (close == -1 && start != end) {
171 | endLine = self.getLine(--end);
172 | close = endLine.indexOf(endString);
173 | }
174 | if (close == -1 ||
175 | !/comment/.test(self.getTokenTypeAt(Pos(start, open + 1))) ||
176 | !/comment/.test(self.getTokenTypeAt(Pos(end, close + 1))))
177 | return false;
178 |
179 | // Avoid killing block comments completely outside the selection.
180 | // Positions of the last startString before the start of the selection, and the first endString after it.
181 | var lastStart = startLine.lastIndexOf(startString, from.ch);
182 | var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
183 | if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
184 | // Positions of the first endString after the end of the selection, and the last startString before it.
185 | firstEnd = endLine.indexOf(endString, to.ch);
186 | var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
187 | lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
188 | if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
189 |
190 | self.operation(function() {
191 | self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
192 | Pos(end, close + endString.length));
193 | var openEnd = open + startString.length;
194 | if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
195 | self.replaceRange("", Pos(start, open), Pos(start, openEnd));
196 | if (lead) for (var i = start + 1; i <= end; ++i) {
197 | var line = self.getLine(i), found = line.indexOf(lead);
198 | if (found == -1 || nonWS.test(line.slice(0, found))) continue;
199 | var foundEnd = found + lead.length;
200 | if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
201 | self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
202 | }
203 | });
204 | return true;
205 | });
206 | });
207 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/lib_codemirror_css/Ext/Template.txt:
--------------------------------------------------------------------------------
1 | /* BASICS */
2 |
3 | .CodeMirror {
4 | /* Set height, width, borders, and global font properties here */
5 | font-family: monospace;
6 | height: 300px;
7 | color: black;
8 | direction: ltr;
9 | }
10 |
11 | /* PADDING */
12 |
13 | .CodeMirror-lines {
14 | padding: 4px 0; /* Vertical padding around content */
15 | }
16 | .CodeMirror pre {
17 | padding: 0 4px; /* Horizontal padding of content */
18 | }
19 |
20 | .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
21 | background-color: white; /* The little square between H and V scrollbars */
22 | }
23 |
24 | /* GUTTER */
25 |
26 | .CodeMirror-gutters {
27 | border-right: 1px solid #ddd;
28 | background-color: #f7f7f7;
29 | white-space: nowrap;
30 | }
31 | .CodeMirror-linenumbers {}
32 | .CodeMirror-linenumber {
33 | padding: 0 3px 0 5px;
34 | min-width: 20px;
35 | text-align: right;
36 | color: #999;
37 | white-space: nowrap;
38 | }
39 |
40 | .CodeMirror-guttermarker { color: black; }
41 | .CodeMirror-guttermarker-subtle { color: #999; }
42 |
43 | /* CURSOR */
44 |
45 | .CodeMirror-cursor {
46 | border-left: 1px solid black;
47 | border-right: none;
48 | width: 0;
49 | }
50 | /* Shown when moving in bi-directional text */
51 | .CodeMirror div.CodeMirror-secondarycursor {
52 | border-left: 1px solid silver;
53 | }
54 | .cm-fat-cursor .CodeMirror-cursor {
55 | width: auto;
56 | border: 0 !important;
57 | background: #7e7;
58 | }
59 | .cm-fat-cursor div.CodeMirror-cursors {
60 | z-index: 1;
61 | }
62 | .cm-fat-cursor-mark {
63 | background-color: rgba(20, 255, 20, 0.5);
64 | -webkit-animation: blink 1.06s steps(1) infinite;
65 | -moz-animation: blink 1.06s steps(1) infinite;
66 | animation: blink 1.06s steps(1) infinite;
67 | }
68 | .cm-animate-fat-cursor {
69 | width: auto;
70 | border: 0;
71 | -webkit-animation: blink 1.06s steps(1) infinite;
72 | -moz-animation: blink 1.06s steps(1) infinite;
73 | animation: blink 1.06s steps(1) infinite;
74 | background-color: #7e7;
75 | }
76 | @-moz-keyframes blink {
77 | 0% {}
78 | 50% { background-color: transparent; }
79 | 100% {}
80 | }
81 | @-webkit-keyframes blink {
82 | 0% {}
83 | 50% { background-color: transparent; }
84 | 100% {}
85 | }
86 | @keyframes blink {
87 | 0% {}
88 | 50% { background-color: transparent; }
89 | 100% {}
90 | }
91 |
92 | /* Can style cursor different in overwrite (non-insert) mode */
93 | .CodeMirror-overwrite .CodeMirror-cursor {}
94 |
95 | .cm-tab { display: inline-block; text-decoration: inherit; }
96 |
97 | .CodeMirror-rulers {
98 | position: absolute;
99 | left: 0; right: 0; top: -50px; bottom: -20px;
100 | overflow: hidden;
101 | }
102 | .CodeMirror-ruler {
103 | border-left: 1px solid #ccc;
104 | top: 0; bottom: 0;
105 | position: absolute;
106 | }
107 |
108 | /* DEFAULT THEME */
109 |
110 | .cm-s-default .cm-header {color: blue;}
111 | .cm-s-default .cm-quote {color: #090;}
112 | .cm-negative {color: #d44;}
113 | .cm-positive {color: #292;}
114 | .cm-header, .cm-strong {font-weight: bold;}
115 | .cm-em {font-style: italic;}
116 | .cm-link {text-decoration: underline;}
117 | .cm-strikethrough {text-decoration: line-through;}
118 |
119 | .cm-s-default .cm-keyword {color: #708;}
120 | .cm-s-default .cm-atom {color: #219;}
121 | .cm-s-default .cm-number {color: #164;}
122 | .cm-s-default .cm-def {color: #00f;}
123 | .cm-s-default .cm-variable,
124 | .cm-s-default .cm-punctuation,
125 | .cm-s-default .cm-property,
126 | .cm-s-default .cm-operator {}
127 | .cm-s-default .cm-variable-2 {color: #05a;}
128 | .cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
129 | .cm-s-default .cm-comment {color: #a50;}
130 | .cm-s-default .cm-string {color: #a11;}
131 | .cm-s-default .cm-string-2 {color: #f50;}
132 | .cm-s-default .cm-meta {color: #555;}
133 | .cm-s-default .cm-qualifier {color: #555;}
134 | .cm-s-default .cm-builtin {color: #30a;}
135 | .cm-s-default .cm-bracket {color: #997;}
136 | .cm-s-default .cm-tag {color: #170;}
137 | .cm-s-default .cm-attribute {color: #00c;}
138 | .cm-s-default .cm-hr {color: #999;}
139 | .cm-s-default .cm-link {color: #00c;}
140 |
141 | .cm-s-default .cm-error {color: #f00;}
142 | .cm-invalidchar {color: #f00;}
143 |
144 | .CodeMirror-composing { border-bottom: 2px solid; }
145 |
146 | /* Default styles for common addons */
147 |
148 | div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
149 | div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
150 | .CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
151 | .CodeMirror-activeline-background {background: #e8f2ff;}
152 |
153 | /* STOP */
154 |
155 | /* The rest of this file contains styles related to the mechanics of
156 | the editor. You probably shouldn't touch them. */
157 |
158 | .CodeMirror {
159 | position: relative;
160 | overflow: hidden;
161 | background: white;
162 | }
163 |
164 | .CodeMirror-scroll {
165 | overflow: scroll !important; /* Things will break if this is overridden */
166 | /* 30px is the magic margin used to hide the element's real scrollbars */
167 | /* See overflow: hidden in .CodeMirror */
168 | margin-bottom: -30px; margin-right: -30px;
169 | padding-bottom: 30px;
170 | height: 100%;
171 | outline: none; /* Prevent dragging from highlighting the element */
172 | position: relative;
173 | }
174 | .CodeMirror-sizer {
175 | position: relative;
176 | border-right: 30px solid transparent;
177 | }
178 |
179 | /* The fake, visible scrollbars. Used to force redraw during scrolling
180 | before actual scrolling happens, thus preventing shaking and
181 | flickering artifacts. */
182 | .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
183 | position: absolute;
184 | z-index: 6;
185 | display: none;
186 | }
187 | .CodeMirror-vscrollbar {
188 | right: 0; top: 0;
189 | overflow-x: hidden;
190 | overflow-y: scroll;
191 | }
192 | .CodeMirror-hscrollbar {
193 | bottom: 0; left: 0;
194 | overflow-y: hidden;
195 | overflow-x: scroll;
196 | }
197 | .CodeMirror-scrollbar-filler {
198 | right: 0; bottom: 0;
199 | }
200 | .CodeMirror-gutter-filler {
201 | left: 0; bottom: 0;
202 | }
203 |
204 | .CodeMirror-gutters {
205 | position: absolute; left: 0; top: 0;
206 | min-height: 100%;
207 | z-index: 3;
208 | }
209 | .CodeMirror-gutter {
210 | white-space: normal;
211 | height: 100%;
212 | display: inline-block;
213 | vertical-align: top;
214 | margin-bottom: -30px;
215 | }
216 | .CodeMirror-gutter-wrapper {
217 | position: absolute;
218 | z-index: 4;
219 | background: none !important;
220 | border: none !important;
221 | }
222 | .CodeMirror-gutter-background {
223 | position: absolute;
224 | top: 0; bottom: 0;
225 | z-index: 4;
226 | }
227 | .CodeMirror-gutter-elt {
228 | position: absolute;
229 | cursor: default;
230 | z-index: 4;
231 | }
232 | .CodeMirror-gutter-wrapper ::selection { background-color: transparent }
233 | .CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
234 |
235 | .CodeMirror-lines {
236 | cursor: text;
237 | min-height: 1px; /* prevents collapsing before first draw */
238 | }
239 | .CodeMirror pre {
240 | /* Reset some styles that the rest of the page might have set */
241 | -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
242 | border-width: 0;
243 | background: transparent;
244 | font-family: inherit;
245 | font-size: inherit;
246 | margin: 0;
247 | white-space: pre;
248 | word-wrap: normal;
249 | line-height: inherit;
250 | color: inherit;
251 | z-index: 2;
252 | position: relative;
253 | overflow: visible;
254 | -webkit-tap-highlight-color: transparent;
255 | -webkit-font-variant-ligatures: contextual;
256 | font-variant-ligatures: contextual;
257 | }
258 | .CodeMirror-wrap pre {
259 | word-wrap: break-word;
260 | white-space: pre-wrap;
261 | word-break: normal;
262 | }
263 |
264 | .CodeMirror-linebackground {
265 | position: absolute;
266 | left: 0; right: 0; top: 0; bottom: 0;
267 | z-index: 0;
268 | }
269 |
270 | .CodeMirror-linewidget {
271 | position: relative;
272 | z-index: 2;
273 | padding: 0.1px; /* Force widget margins to stay inside of the container */
274 | }
275 |
276 | .CodeMirror-widget {}
277 |
278 | .CodeMirror-rtl pre { direction: rtl; }
279 |
280 | .CodeMirror-code {
281 | outline: none;
282 | }
283 |
284 | /* Force content-box sizing for the elements where we expect it */
285 | .CodeMirror-scroll,
286 | .CodeMirror-sizer,
287 | .CodeMirror-gutter,
288 | .CodeMirror-gutters,
289 | .CodeMirror-linenumber {
290 | -moz-box-sizing: content-box;
291 | box-sizing: content-box;
292 | }
293 |
294 | .CodeMirror-measure {
295 | position: absolute;
296 | width: 100%;
297 | height: 0;
298 | overflow: hidden;
299 | visibility: hidden;
300 | }
301 |
302 | .CodeMirror-cursor {
303 | position: absolute;
304 | pointer-events: none;
305 | }
306 | .CodeMirror-measure pre { position: static; }
307 |
308 | div.CodeMirror-cursors {
309 | visibility: hidden;
310 | position: relative;
311 | z-index: 3;
312 | }
313 | div.CodeMirror-dragcursors {
314 | visibility: visible;
315 | }
316 |
317 | .CodeMirror-focused div.CodeMirror-cursors {
318 | visibility: visible;
319 | }
320 |
321 | .CodeMirror-selected { background: #d9d9d9; }
322 | .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
323 | .CodeMirror-crosshair { cursor: crosshair; }
324 | .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
325 | .CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
326 |
327 | .cm-searching {
328 | background-color: #ffa;
329 | background-color: rgba(255, 255, 0, .4);
330 | }
331 |
332 | /* Used to force a border model for a node */
333 | .cm-force-border { padding-right: .1px; }
334 |
335 | @media print {
336 | /* Hide the cursor when printing */
337 | .CodeMirror div.CodeMirror-cursors {
338 | visibility: hidden;
339 | }
340 | }
341 |
342 | /* See issue #2901 */
343 | .cm-tab-wrap-hack:after { content: ''; }
344 |
345 | /* Help users use markselection to safely style text background */
346 | span.CodeMirror-selectedtext { background: none; }
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Templates/mode_1c_1c_js/Ext/Template.txt:
--------------------------------------------------------------------------------
1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others
2 | // for 1C - http://code1c.sikuda.ru/
3 | // Distributed under an MIT license: http://codemirror.net/LICENSE
4 |
5 | (function(mod) {
6 | if (typeof exports == "object" && typeof module == "object") // CommonJS
7 | mod(require("../../lib/codemirror"));
8 | else if (typeof define == "function" && define.amd) // AMD
9 | define(["../../lib/codemirror"], mod);
10 | else // Plain browser env
11 | mod(CodeMirror);
12 | })(function(CodeMirror) {
13 | "use strict";
14 |
15 | CodeMirror.defineMode("1c", function(conf, parserConf) {
16 | var ERRORCLASS = 'error';
17 |
18 | function wordRegexp(words) {
19 | return new RegExp("^((" + words.join(")|(") + "))([ ;\\/\\n\\t]|$)", "i"); //\\b \\W //[^$A-Za-z0-9А-ЯЁа-яё_]
20 | }
21 |
22 | var singleOperators = new RegExp("^[\\+\\-\\*/%&<>=]");
23 | var singleDelimiters = new RegExp("^[\\(\\)\\[\\]\\{\\},:=;\\.]");
24 | var doubleOperators = new RegExp("^((<>)|(<=)|(>=))");
25 | var identifiers = new RegExp("^[_A-Za-zА-ЯЁа-яё][_A-Za-z0-9А-ЯЁа-яё]*");
26 |
27 | var openingKeywords = ['если', 'if', 'пока', 'while', 'для', 'for', 'процедура', 'procedure', 'функция', 'function', 'попытка', 'try'];
28 | var middleKeywords = ['иначе', 'else', 'иначеесли', 'elsif', 'исключение', 'except'];
29 | var doubleClosing = wordRegexp(['конецесли', 'endif', 'конеццикла', 'конецпроцедуры', 'endprocedure', 'конецфункции', 'endfunction', 'конецпопытки', 'endtry']);
30 | var endKeywords = ['loop'];
31 | var operatorKeywords = ['and', 'or', 'not', 'xor', 'in'];
32 | var commonKeywords = ['новый', 'new', 'каждого', 'each', 'из', 'from', 'цикл', 'do', 'или', 'or', 'не', 'not', 'ложь', 'false', 'истина', 'true', 'и','and', 'возврат', 'return', 'тогда', 'then', 'экспорт', 'export', 'неопределено', 'undefined', 'продолжить', 'continue', 'прервать', 'break', 'перейти', 'goto', 'по', 'to' , 'null'];
33 | var commontypes = ['перем', 'var'];
34 |
35 | var wordOperators = wordRegexp(operatorKeywords);
36 | var keywords = wordRegexp(commonKeywords);
37 | var types = wordRegexp(commontypes);
38 | var stringPrefixes = '"';
39 | var stringNewLine = '|';
40 |
41 | var opening = wordRegexp(openingKeywords);
42 | var middle = wordRegexp(middleKeywords);
43 | var closing = wordRegexp(endKeywords);
44 | var doOpening = wordRegexp(['do', 'пока']);
45 |
46 | var indentInfo = null;
47 |
48 | CodeMirror.registerHelper("hintWords", "1c", openingKeywords.concat(middleKeywords).concat(endKeywords).concat(operatorKeywords).concat(commonKeywords).concat(commontypes));
49 |
50 | //CodeMirror.registerHelper("hint", "1c", openingKeywords.concat(middleKeywords).concat(endKeywords).concat(operatorKeywords).concat(commonKeywords).concat(commontypes));
51 |
52 | function indent(_stream, state) {
53 | state.currentIndent++;
54 | }
55 |
56 | function dedent(_stream, state) {
57 | state.currentIndent--;
58 | }
59 | // tokenizers
60 | function tokenBase(stream, state) {
61 | if (stream.eatSpace()) {
62 | return null;
63 | }
64 |
65 | var ch = stream.peek();
66 |
67 | // Handle Comments
68 | if (ch === "/") {
69 | var ch_next = stream.string.charAt(stream.pos+1) || undefined;
70 | if (ch_next === "/") {
71 | stream.skipToEnd();
72 | return "comment";
73 | }
74 | }
75 |
76 | //handle meta - &OnClient or #If
77 | if (ch === "&" || ch === "#") {
78 | stream.skipToEnd();
79 | return "meta";
80 | }
81 |
82 | //~nameLabel
83 | if (ch === "~"){
84 | stream.next();
85 | stream.match(identifiers);
86 | return 'label';
87 | }
88 |
89 |
90 | // Handle Number Literals
91 | if (stream.match(/^\.?[0-9]{1,}/i, false)) {
92 | var floatLiteral = false;
93 | // Floats
94 | if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; }
95 | else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; }
96 | else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; }
97 |
98 | if (floatLiteral) {
99 | // Float literals may be "imaginary"
100 | stream.eat(/J/i);
101 | return 'number';
102 | }
103 | // Integers
104 | var intLiteral = false;
105 | // Hex
106 | if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
107 | // Octal
108 | else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
109 | // Decimal
110 | else if (stream.match(/^[0-9]\d*F?/)) {
111 | // Decimal literals may be "imaginary"
112 | stream.eat(/J/i);
113 | // TODO - Can you have imaginary longs?
114 | intLiteral = true;
115 | }
116 | // Zero by itself with no other piece of number.
117 | else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
118 | if (intLiteral) {
119 | // Integer literals may be "long"
120 | stream.eat(/L/i);
121 | return 'number';
122 | }
123 | }
124 |
125 | // Handle Strings
126 | if (stream.match(stringPrefixes)) {
127 | state.tokenize = tokenStringFactory(stringPrefixes);
128 | return state.tokenize(stream, state);
129 | }
130 | if (stream.match(stringNewLine)) {
131 | state.tokenize = tokenStringFactory(stringPrefixes);
132 | return state.tokenize(stream, state);
133 | }
134 |
135 |
136 | if (stream.match(doubleOperators)
137 | || stream.match(singleOperators)
138 | || stream.match(wordOperators)) {
139 | return 'operator';
140 | }
141 | if (stream.match(singleDelimiters)) {
142 | return 'delimiter';
143 | }
144 | if (stream.match(doOpening)) {
145 | indent(stream,state);
146 | state.doInCurrentLine = true;
147 | return 'keyword';
148 | }
149 | if (stream.match(opening)) {
150 | if (! state.doInCurrentLine)
151 | indent(stream,state);
152 | else
153 | state.doInCurrentLine = false;
154 | return 'keyword';
155 | }
156 | if (stream.match(middle)) {
157 | return 'keyword';
158 | }
159 |
160 | if (stream.match(doubleClosing)) {
161 | //dedent(stream,state);
162 | dedent(stream,state);
163 | return 'keyword';
164 | }
165 | if (stream.match(closing)) {
166 | dedent(stream,state);
167 | return 'keyword';
168 | }
169 |
170 | if (stream.match(types)) {
171 | return 'keyword';
172 | }
173 |
174 | if (stream.match(keywords)) {
175 | return 'keyword';
176 | }
177 |
178 | if (stream.match(identifiers)) {
179 | return 'variable';
180 | }
181 |
182 | // Handle non-detected items
183 | stream.next();
184 | return ERRORCLASS;
185 | }
186 |
187 | function tokenStringFactory(delimiter) {
188 | var singleline = delimiter.length == 1;
189 | var OUTCLASS = 'string';
190 |
191 | return function(stream, state) {
192 | while (!stream.eol()) {
193 | stream.eatWhile(/[^'"]/);
194 | if (stream.match(delimiter)) {
195 | state.tokenize = tokenBase;
196 | return OUTCLASS;
197 | } else {
198 | stream.eat(/['"]/);
199 | }
200 | }
201 | if (singleline) {
202 | if (parserConf.singleLineStringErrors) {
203 | return ERRORCLASS;
204 | } else {
205 | state.tokenize = tokenBase;
206 | }
207 | }
208 | return OUTCLASS;
209 | };
210 | }
211 |
212 |
213 | function tokenLexer(stream, state) {
214 | var style = state.tokenize(stream, state);
215 | var current = stream.current();
216 |
217 | var delimiter_index = '[({'.indexOf(current);
218 | if (delimiter_index !== -1) {
219 | indent(stream, state );
220 | }
221 | if (indentInfo === 'dedent') {
222 | if (dedent(stream, state)) {
223 | return ERRORCLASS;
224 | }
225 | }
226 | delimiter_index = '])}'.indexOf(current);
227 | if (delimiter_index !== -1) {
228 | if (dedent(stream, state)) {
229 | return ERRORCLASS;
230 | }
231 | }
232 | return style;
233 | }
234 |
235 | var external = {
236 | electricChars:"dDpPtTfFeE ",
237 | startState: function() {
238 | return {
239 | tokenize: tokenBase,
240 | lastToken: null,
241 | currentIndent: 0,
242 | nextLineIndent: 0,
243 | doInCurrentLine: false
244 | };
245 | },
246 |
247 | token: function(stream, state) {
248 | if (stream.sol()) {
249 | state.currentIndent += state.nextLineIndent;
250 | state.nextLineIndent = 0;
251 | state.doInCurrentLine = 0;
252 | }
253 | var style = tokenLexer(stream, state);
254 | state.lastToken = {style:style, content: stream.current()};
255 | return style;
256 | },
257 |
258 | indent: function(state, textAfter) {
259 | var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
260 | if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
261 | if(state.currentIndent < 0) return 0;
262 | return state.currentIndent * conf.indentUnit;
263 | },
264 |
265 | lineComment: "'"
266 | };
267 | return external;
268 | });
269 |
270 | CodeMirror.defineMIME("text/x-1c", "1c");
271 |
272 | });
273 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Forms/ФормаУправляемая/Ext/Form/Module.bsl:
--------------------------------------------------------------------------------
1 |
2 | #Область ОбработчикиСобытийФормы
3 |
4 | &НаСервере
5 | Процедура ПриСозданииНаСервере(Отказ, СтандартнаяОбработка)
6 |
7 | ЗаполнитьТребования();
8 |
9 | Модули = бпк_ПроверкаКодаСервер.ТипыОбъектовДляПроверки();
10 |
11 | Для каждого ЭлементСписка Из Модули Цикл
12 | Элементы.ТипМодуля.СписокВыбора.Добавить(ЭлементСписка.Значение, ЭлементСписка.Представление);
13 | КонецЦикла;
14 |
15 | КонецПроцедуры
16 |
17 | &НаКлиенте
18 | Процедура ПриОткрытии(Отказ)
19 |
20 | УстановитьДоступностьСвойствОбщегоМодуля();
21 |
22 | КонецПроцедуры
23 |
24 | &НаСервере
25 | Процедура ПриЗагрузкеДанныхИзНастроекНаСервере(Настройки)
26 |
27 | ВыбранныеТребования = Настройки["НастройкиВыбранныхТребований"];
28 | ОтметитьВыбранныеТребования(Требования.ПолучитьЭлементы(), ВыбранныеТребования);
29 |
30 | ИнициализироватьТекстМодуляHTML(ТекстМодуля);
31 |
32 | КонецПроцедуры
33 |
34 | &НаСервере
35 | Процедура ПриСохраненииДанныхВНастройкахНаСервере(Настройки)
36 |
37 | ВыбранныеТребования = Новый Массив;
38 | ЗаполнитьВыбранныеТребования(Требования.ПолучитьЭлементы(), ВыбранныеТребования, Истина);
39 |
40 | Настройки.Вставить("НастройкиВыбранныхТребований", ВыбранныеТребования);
41 |
42 | Настройки.Удалить("Требования");
43 |
44 | КонецПроцедуры
45 |
46 | #КонецОбласти
47 |
48 | #Область ОбработчикиСобытийЭлементовШапкиФормы
49 |
50 | &НаКлиенте
51 | Процедура ТребованияПометкаПриИзменении(Элемент)
52 |
53 | ТекущиеДанные = Элементы.Требования.ТекущиеДанные;
54 | ИзменитьРекурсивноПометкиВнизПоИерархии(ТекущиеДанные, ТекущиеДанные.Пометка);
55 |
56 | ИзменитьРекурсивноПометкиВверхПоИерархии(ТекущиеДанные, ТекущиеДанные.Пометка);
57 |
58 | КонецПроцедуры
59 |
60 | &НаКлиенте
61 | Процедура ТипМодуляПриИзменении(Элемент)
62 |
63 | УстановитьДоступностьСвойствОбщегоМодуля();
64 |
65 | КонецПроцедуры
66 |
67 | &НаКлиенте
68 | Процедура ОшибкиПриАктивизацииСтроки(Элемент)
69 |
70 | ТекущиеДанные = Элементы.Ошибки.ТекущиеДанные;
71 |
72 | Если ТекущиеДанные = Неопределено Тогда
73 | Возврат;
74 | КонецЕсли;
75 |
76 | ПерейтиКСтрокеРезультатаПоНомеруСтроки(ТекущиеДанные.Номер);
77 |
78 | КонецПроцедуры
79 |
80 | &НаКлиенте
81 | Процедура ОшибкиПриАктивизацииЯчейки(Элемент)
82 |
83 | Если НЕ Элемент.ТекущийЭлемент.Имя = "ОшибкиСсылка" Тогда
84 | Возврат;
85 | КонецЕсли;
86 | ТекущиеДанные = Элементы.Ошибки.ТекущиеДанные;
87 |
88 | ДополнительныеПараметры = Новый Структура;
89 | ДополнительныеПараметры.Вставить("Ошибка", ТекущиеДанные.Ошибка);
90 | ДополнительныеПараметры.Вставить("Правило", ТекущиеДанные.Правило);
91 | ДополнительныеПараметры.Вставить("СсылкаНаСтандарт", ТекущиеДанные.СсылкаНаСтандарт);
92 | ДополнительныеПараметры.Вставить("Требование", ТекущиеДанные.Требование);
93 |
94 | Список = Новый СписокЗначений;
95 |
96 | Если ЗначениеЗаполнено(ТекущиеДанные.СсылкаНаСтандарт) Тогда
97 |
98 | Представление = СтрШаблон("Система стандартов на 1С:ИТС > %1", ТекущиеДанные.ОписаниеТребования);
99 |
100 | Список.Добавить("ОткрытьСсылкуНаСтандарт", Представление, , БиблиотекаКартинок.бпк_ИТС);
101 | КонецЕсли;
102 |
103 | Список.Добавить("ПерейтиКПравилу", "Перейти к правилу");
104 |
105 | Если ЗначениеЗаполнено(ТекущиеДанные.Требование) Тогда
106 | Список.Добавить("ПерейтиКТребованию", "Перейти к требованию");
107 | КонецЕсли;
108 |
109 | ОписаниеОповещения = Новый ОписаниеОповещения("ПоказатьВыборИзМенюЗавершение",
110 | ЭтотОбъект, ДополнительныеПараметры);
111 |
112 | ПоказатьВыборИзМеню(ОписаниеОповещения, Список, Элемент.ТекущийЭлемент);
113 |
114 | КонецПроцедуры
115 |
116 | #КонецОбласти
117 |
118 | #Область ОбработчикиКомандФормы
119 |
120 | &НаКлиенте
121 | Процедура СнятьПометки(Команда)
122 |
123 | ИзменитьРекурсивноПометкиВнизПоИерархии(Требования, Ложь);
124 |
125 | КонецПроцедуры
126 |
127 | &НаКлиенте
128 | Процедура УстановитьПометки(Команда)
129 |
130 | ИзменитьРекурсивноПометкиВнизПоИерархии(Требования, Истина);
131 |
132 | КонецПроцедуры
133 |
134 | &НаКлиенте
135 | Процедура ВыполнитьПроверкуКода(Команда)
136 | ТекстМодуля = ПолучитьТекстМодуля();
137 |
138 | Если Не ПроверитьЗаполнение() Тогда
139 | Возврат;
140 | КонецЕсли;
141 |
142 | Результат = ВыполнитьПроверкуКодаДлительнойОперацией();
143 |
144 | Если НЕ Результат Тогда
145 | ДлительныеОперацииКлиент.ИнициализироватьПараметрыОбработчикаОжидания(ПараметрыОбработчикаОжидания);
146 | ПодключитьОбработчикОжидания("Подключаемый_ПроверитьВыполнениеЗадания", 1, Истина);
147 | Иначе
148 | ОбработатьРезультатПроверки();
149 | КонецЕсли;
150 |
151 | КонецПроцедуры
152 |
153 | #КонецОбласти
154 |
155 | #Область СлужебныеПроцедурыИФункции
156 |
157 | &НаСервере
158 | Процедура ИнициализироватьТекстМодуляHTML(ИсполняемыйКод = "")
159 |
160 | РаботатьЛокально = Истина; // Если ложь - берем с сайта последние обновления файлов js.
161 |
162 | ОбъектСервера = РеквизитФормыВЗначение("Объект");
163 |
164 | ТекстHTML = ОбъектСервера.Получитьмакет("index").ПолучитьТекст();
165 |
166 | ТекстЗамены = СтрШаблон("", ИсполняемыйКод);
167 | ТекстHTML = СтрЗаменить(ТекстHTML, "", ТекстЗамены);
168 |
169 | ТекстСтиля = ОбъектСервера.Получитьмакет("lib_codemirror_css").ПолучитьТекст();
170 | ТекстЗамены = СтрШаблон("", ТекстСтиля);
171 |
172 | ТекстHTML = СтрЗаменить(ТекстHTML,
173 | "", ТекстЗамены);
174 |
175 | ТекстСтиля = ОбъектСервера.Получитьмакет("theme_1c_css").ПолучитьТекст();
176 | ТекстЗамены = СтрШаблон("", ТекстСтиля);
177 |
178 | ТекстHTML = СтрЗаменить(ТекстHTML,
179 | "", ТекстЗамены);
180 |
181 | Если РаботатьЛокально Тогда
182 |
183 | ТекстСкрипта = ОбъектСервера.Получитьмакет("mode_1c_1c_js").ПолучитьТекст();
184 | ТекстЗамены = СтрШаблон("", ТекстСкрипта);
185 | ТекстHTML = СтрЗаменить(ТекстHTML,
186 | "", ТекстЗамены);
187 |
188 | ТекстСкрипта = ОбъектСервера.Получитьмакет("addon_comment_comment_js").ПолучитьТекст();
189 | ТекстЗамены = СтрШаблон("", ТекстСкрипта);
190 | ТекстHTML = СтрЗаменить(ТекстHTML,
191 | "", ТекстЗамены);
192 |
193 | ТекстСкрипта = ОбъектСервера.Получитьмакет("lib_codemirror_js").ПолучитьТекст();
194 | ТекстЗамены = СтрШаблон("", ТекстСкрипта);
195 | ТекстHTML = СтрЗаменить(ТекстHTML,
196 | "", ТекстЗамены);
197 |
198 | КонецЕсли;
199 |
200 | ТекстМодуляHTML = ТекстHTML;
201 |
202 | КонецПроцедуры
203 |
204 | &НаКлиенте
205 | Функция ПолучитьТекстМодуля()
206 |
207 | #Если ВебКлиент Тогда
208 | // Код берется из копии в textarea id=code.
209 | ИсполняемыйКод = Элементы.ТекстМодуляHTML.Документ.body.ChildNodes[1].innerHTML;
210 | #Иначе
211 | ИсполняемыйКод = Элементы.ТекстМодуляHTML.Document.editor.getValue();
212 | #КонецЕсли
213 |
214 | Возврат ИсполняемыйКод;
215 |
216 | КонецФункции
217 |
218 | &НаСервере
219 | Функция ВыполнитьПроверкуКодаНаСервере()
220 |
221 | ПараметрыПроверки = бпк_ПроверкаКодаСервер.ПараметрыПроверки();
222 | ПодготовитьПараметрыПроверки(ПараметрыПроверки);
223 |
224 | ПараметрыВыполнения = ДлительныеОперации.ПараметрыВыполненияВФоне(Новый УникальныйИдентификатор);
225 | ПараметрыВыполнения.НаименованиеФоновогоЗадания = НСтр("ru='Проверка кода: %1'");
226 | РезультатВыполнения = ДлительныеОперации.ВыполнитьВФоне(
227 | "бпк_ПроверкаКодаСервер.ПроверитьКод", ПараметрыПроверки, ПараметрыВыполнения);
228 |
229 | Возврат РезультатВыполнения;
230 |
231 | КонецФункции
232 |
233 | &НаКлиенте
234 | Функция ВыполнитьПроверкуКодаДлительнойОперацией()
235 |
236 | ИдентификаторЗадания = Неопределено;
237 | ОписаниеОшибки = "";
238 |
239 | ТекстОповещения = НСтр("ru='Начата проверка модуля.'");
240 | КлючУникальности = Строка(Новый УникальныйИдентификатор);
241 | ПоказатьОповещениеПользователя(ТекстОповещения, , , , СтатусОповещенияПользователя.Важное, КлючУникальности);
242 |
243 | РезультатВыполнения = ВыполнитьПроверкуКодаНаСервере();
244 |
245 | АдресРезультата = РезультатВыполнения.АдресРезультата;
246 |
247 | Если РезультатВыполнения.Статус <> "Выполняется" Тогда
248 | ИдентификаторЗадания = Неопределено;
249 | Если РезультатВыполнения.Статус = "Выполнено" Тогда
250 | ОбработатьРезультатПроверки();
251 | КонецЕсли;
252 | Иначе
253 | ИдентификаторЗадания = РезультатВыполнения.ИдентификаторЗадания;
254 | КонецЕсли;
255 |
256 | Возврат РезультатВыполнения.Статус <> "Выполняется";
257 |
258 | КонецФункции
259 |
260 | &НаКлиенте
261 | Процедура Подключаемый_ПроверитьВыполнениеЗадания()
262 |
263 | Если НЕ ЗначениеЗаполнено(ИдентификаторЗадания) Тогда
264 | Возврат;
265 | КонецЕсли;
266 |
267 | Если ЗаданиеВыполнено() Тогда
268 |
269 | ИдентификаторЗадания = Неопределено;
270 | ОбработатьРезультатПроверки();
271 |
272 | Иначе
273 | ДлительныеОперацииКлиент.ОбновитьПараметрыОбработчикаОжидания(ПараметрыОбработчикаОжидания);
274 | ПодключитьОбработчикОжидания("Подключаемый_ПроверитьВыполнениеЗадания",
275 | ПараметрыОбработчикаОжидания.ТекущийИнтервал, Истина);
276 | КонецЕсли;
277 |
278 | КонецПроцедуры
279 |
280 | &НаСервере
281 | Функция ЗаданиеВыполнено()
282 |
283 | Возврат ДлительныеОперации.ЗаданиеВыполнено(ИдентификаторЗадания);
284 |
285 | КонецФункции
286 |
287 | &НаКлиенте
288 | Процедура ОбработатьРезультатПроверки()
289 |
290 | Результат = ПолучитьИзВременногоХранилища(АдресРезультата);
291 |
292 | КоличествоЗамечаний = Результат.КоличествоОшибок;
293 |
294 | ТекстПояснения = "Замечаний нет.";
295 |
296 | Если Не КоличествоЗамечаний = 0 Тогда
297 | ТекстПояснения = СтрШаблон("Найдено замечаний: %1.", КоличествоЗамечаний);
298 | КонецЕсли;
299 |
300 | СформироватьТаблицуНавигации(Результат.Ошибки);
301 |
302 | ТекстОповещения = НСтр("ru='Проверка модуля завершена.'");
303 | КлючУникальности = Строка(Новый УникальныйИдентификатор);
304 |
305 | ПоказатьОповещениеПользователя(ТекстОповещения, , ТекстПояснения, , СтатусОповещенияПользователя.Важное,
306 | КлючУникальности);
307 |
308 | КонецПроцедуры
309 |
310 | &НаСервере
311 | Процедура СформироватьТаблицуНавигации(НайденныеОшибки)
312 |
313 | Ошибки.Очистить();
314 |
315 | Для каждого НайденнаяОшибка Из НайденныеОшибки Цикл
316 |
317 | НоваяСтрока = Ошибки.Добавить();
318 | ЗаполнитьЗначенияСвойств(НоваяСтрока, НайденнаяОшибка);
319 |
320 | ОписаниеОшибки = бпк_ПроверкаКодаПовтИсп.ПолучитьОписаниеОшибки(НайденнаяОшибка.Ошибка);
321 | ЗаполнитьЗначенияСвойств(НоваяСтрока, ОписаниеОшибки);
322 |
323 | МестоОбнаружения = СтрЗаменить(НайденнаяОшибка.МестоОбнаружения, "Модуль, ", "");
324 |
325 | НоваяСтрока.Описание = СтрШаблон("%1, %2", МестоОбнаружения, НайденнаяОшибка.Ошибка.Наименование);
326 |
327 | КонецЦикла;
328 |
329 | Ошибки.Сортировать("Номер");
330 |
331 | КонецПроцедуры
332 |
333 | &НаСервере
334 | Процедура ПодготовитьПараметрыПроверки(ПараметрыПроверки)
335 |
336 | ВыбранныеТребования = Новый Массив;
337 |
338 | ТекущиеЭлементы = Требования.ПолучитьЭлементы();
339 | ЗаполнитьВыбранныеТребования(ТекущиеЭлементы, ВыбранныеТребования);
340 |
341 | ПараметрыПроверки.Вставить("ТипОбъекта", ТипМодуля);
342 | ПараметрыПроверки.Вставить("Требования", ВыбранныеТребования);
343 | ПараметрыПроверки.Вставить("ТекстМодуля", ТекстМодуля);
344 |
345 | СвойстваМодуля = Новый Структура;
346 |
347 | Если ТипМодуля = Перечисления.ТипыОбъектов.ОбщийМодуль Тогда
348 | СвойстваМодуля.Вставить("Сервер", Сервер);
349 | СвойстваМодуля.Вставить("КлиентОбычноеПриложение", КлиентОбычноеПриложение);
350 | СвойстваМодуля.Вставить("КлиентУправляемоеПриложение", КлиентУправляемоеПриложение);
351 | СвойстваМодуля.Вставить("ВнешнееСоединение", ВнешнееСоединение);
352 | КонецЕсли;
353 |
354 | ПараметрыПроверки.Вставить("Свойства", СвойстваМодуля);
355 |
356 | КонецПроцедуры
357 |
358 | &НаКлиенте
359 | Процедура УстановитьДоступностьСвойствОбщегоМодуля()
360 |
361 | Элементы.ГруппаСвойстваОбщегоМодуля.ТолькоПросмотр =
362 | Не (ТипМодуля = ПредопределенноеЗначение("Перечисление.ТипыОбъектов.ОбщийМодуль"));
363 |
364 | КонецПроцедуры
365 |
366 | // Помечает элементы вниз по иерархии
367 | //
368 | &НаКлиенте
369 | Процедура ИзменитьРекурсивноПометкиВнизПоИерархии(ДанныеФормы, Пометка)
370 |
371 | ЭлементыДерева = ДанныеФормы.ПолучитьЭлементы();
372 |
373 | Для каждого ЭлементДерева Из ЭлементыДерева Цикл
374 | ЭлементДерева.Пометка = Пометка;
375 | ИзменитьРекурсивноПометкиВнизПоИерархии(ЭлементДерева, Пометка);
376 | КонецЦикла;
377 |
378 | КонецПроцедуры // РекурсивноВнизСнятьУстановитьПометки
379 |
380 | // Помечает элементы вверх по иерархии
381 | //
382 | &НаКлиенте
383 | Процедура ИзменитьРекурсивноПометкиВверхПоИерархии(ЭлементДерева, Пометка)
384 |
385 | ЭлементДереваРодитель = ЭлементДерева.ПолучитьРодителя();
386 |
387 | Если НЕ ЭлементДереваРодитель = Неопределено Тогда
388 |
389 | Если Пометка Тогда
390 | ЭлементДереваРодитель.Пометка = Пометка;
391 | Иначе
392 | ЕстьПометкаПодчиненныхЭлементов = Ложь;
393 | ПодчиненныеЭлементыРодителя = ЭлементДереваРодитель.ПолучитьЭлементы();
394 | Для каждого ПодчиненныйЭлементРодителя Из ПодчиненныеЭлементыРодителя Цикл
395 |
396 | Если ПодчиненныйЭлементРодителя.Пометка Тогда
397 | ЕстьПометкаПодчиненныхЭлементов = Истина;
398 | КонецЕсли;
399 |
400 | КонецЦикла;
401 |
402 | ЭлементДереваРодитель.Пометка = ЕстьПометкаПодчиненныхЭлементов;
403 |
404 | КонецЕсли;
405 |
406 | ИзменитьРекурсивноПометкиВверхПоИерархии(ЭлементДереваРодитель, Пометка);
407 | КонецЕсли;
408 |
409 | КонецПроцедуры // РекурсивноВверхСнятьУстановитьПометки
410 |
411 | // Функция возвращает таблицу требований для заданной конфигурации и варианта проверки.
412 | //
413 | &НаСервере
414 | Процедура ЗаполнитьТребования()
415 |
416 | Запрос = Новый Запрос;
417 | Запрос.Текст =
418 | "ВЫБРАТЬ
419 | | Требования.Ссылка КАК Требование,
420 | | Требования.Родитель КАК Родитель,
421 | | Требования.ЭтоГруппа КАК ЭтоГруппа,
422 | | ВЫБОР
423 | | КОГДА Требования.ЭтоГруппа
424 | | ТОГДА 1
425 | | ИНАЧЕ 2
426 | | КОНЕЦ КАК ИндексКартинки
427 | |ИЗ
428 | | Справочник.Требования КАК Требования
429 | |ИТОГИ
430 | | МИНИМУМ(ИндексКартинки)
431 | |ПО
432 | | Требование ИЕРАРХИЯ";
433 |
434 | Результат = Запрос.Выполнить().Выгрузить(ОбходРезультатаЗапроса.ПоГруппировкамСИерархией);
435 |
436 | ТекущиеЭлементы = Требования.ПолучитьЭлементы();
437 | ДобавитьВетвьВДерево(Результат.Строки, ТекущиеЭлементы);
438 |
439 | КонецПроцедуры
440 |
441 | &НаСервере
442 | Процедура ДобавитьВетвьВДерево(СтрокиДерева, ТекущиеЭлементы)
443 |
444 | Для каждого СтрокаДерева Из СтрокиДерева Цикл
445 |
446 | Если НЕ СтрокаДерева.Родитель = Неопределено И СтрокаДерева.Требование = СтрокаДерева.Родитель.Требование Тогда
447 | Продолжить;
448 | КонецЕсли;
449 |
450 | НовыйЭлемент = ТекущиеЭлементы.Добавить();
451 | ЗаполнитьЗначенияСвойств(НовыйЭлемент, СтрокаДерева);
452 | ДобавитьВетвьВДерево(СтрокаДерева.Строки, НовыйЭлемент.ПолучитьЭлементы());
453 |
454 | КонецЦикла;
455 |
456 | КонецПроцедуры
457 |
458 | &НаСервере
459 | Процедура ОтметитьВыбранныеТребования(ТекущиеЭлементы, ВыбранныеТребования)
460 |
461 | Для каждого ЭлементДерева Из ТекущиеЭлементы Цикл
462 |
463 | Если Не ВыбранныеТребования = Неопределено
464 | И Не ВыбранныеТребования.Найти(ЭлементДерева.Требование) = Неопределено Тогда
465 | ЭлементДерева.Пометка = Истина;
466 | КонецЕсли;
467 |
468 | Если ЭлементДерева.ЭтоГруппа Тогда
469 | ОтметитьВыбранныеТребования(ЭлементДерева.ПолучитьЭлементы(), ВыбранныеТребования);
470 | КонецЕсли;
471 |
472 | КонецЦикла;
473 |
474 | КонецПроцедуры
475 |
476 | &НаСервере
477 | Процедура ЗаполнитьВыбранныеТребования(ТекущиеЭлементы, ВыбранныеТребования, ВключаяГруппы = Ложь)
478 |
479 | Для каждого ЭлементДерева Из ТекущиеЭлементы Цикл
480 | Если Не ЭлементДерева.Пометка Тогда
481 | Продолжить;
482 | КонецЕсли;
483 |
484 | Если Не ЭлементДерева.ЭтоГруппа Тогда
485 | ВыбранныеТребования.Добавить(ЭлементДерева.Требование);
486 | Иначе
487 |
488 | Если ВключаяГруппы Тогда
489 | ВыбранныеТребования.Добавить(ЭлементДерева.Требование);
490 | КонецЕсли;
491 |
492 | ЗаполнитьВыбранныеТребования(ЭлементДерева.ПолучитьЭлементы(), ВыбранныеТребования, ВключаяГруппы);
493 | КонецЕсли;
494 |
495 | КонецЦикла;
496 |
497 | КонецПроцедуры
498 |
499 | &НаКлиенте
500 | Процедура ПерейтиКСтрокеРезультатаПоНомеруСтроки(НомерСтроки)
501 |
502 | // TO DO Переход к строке
503 |
504 | КонецПроцедуры
505 |
506 | &НаКлиенте
507 | Процедура ПоказатьВыборИзМенюЗавершение(Результат, ДополнительныеПараметры = Неопределено) Экспорт
508 |
509 | Если Результат = Неопределено Тогда
510 | Возврат;
511 | КонецЕсли;
512 |
513 | Если Результат.Значение = "ОткрытьСсылкуНаСтандарт" Тогда
514 |
515 | ЗапуститьПриложение(ДополнительныеПараметры.СсылкаНаСтандарт);
516 |
517 | ИначеЕсли Результат.Значение = "ПерейтиКПравилу" Тогда
518 |
519 | ПоказатьЗначение(, ДополнительныеПараметры.Правило);
520 |
521 | ИначеЕсли Результат.Значение = "ПерейтиКТребованию" Тогда
522 |
523 | ПоказатьЗначение(, ДополнительныеПараметры.Требование);
524 |
525 | Иначе
526 | Возврат;
527 | КонецЕсли;
528 |
529 | КонецПроцедуры
530 |
531 | #КонецОбласти
532 |
--------------------------------------------------------------------------------
/src/DataProcessors/ПроверкаКода/Forms/ФормаУправляемая/Ext/Form.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------